美文网首页
IDEA-have the correct access rig

IDEA-have the correct access rig

作者: _empty_cup | 来源:发表于2019-12-08 15:00 被阅读0次

    在IDEA中导入一个空项目后,在
    1.设置 git 用户名、邮箱
    git config user.name
    git config user.email
    git config --global user.name "你的名字,显示在git提交历史记录里的名字"
    git config --global user.email "你的邮箱,显示在git提交历史记录里的邮箱"
    2.将示例空项目,按 maven 项目导入
    3.使用 git 命令初始化仓库,并将第一个版本上传
    git init
    git add .
    git commit -m "first commit"
    git remote add origin 你创建的github项目地址
    git push -u origin master
    问题:在执行“git push -u origin master”时报错:
    Please make sure you have the correct access rights and the repository exists.

    下面是解决方法:
    1.找了一些解决方案后,发现都提到.ssh文件,小编一脸懵圈不知道这个文件在哪儿?
    mac本 : Finder-->前往-->前往文件夹-->输入~/.ssh
    即:shift+command+G-->输入~/.ssh
    2、删除.ssh文件夹(直接搜索该文件夹)下的known_hosts(手动删除即可,不需要git)
    3、git输入命令
    $ ssh-keygen -t rsa -C "your@email.com"(请填你设置的邮箱地址)
    接着出现:
    Generating public/private rsa key pair.
    Enter file in which to save the key (/Users/your_user_directory/.ssh/id_rsa):
    请直接按下回车
    然后系统会自动在.ssh文件夹下生成两个文件,id_rsa和id_rsa.pub,用记事本打开id_rsa.pub
    将全部的内容复制
    4、打开https://github.com/,登陆你的账户,进入设置
    进入ssh设置

    1.png
    2.png
    在key中将刚刚复制的粘贴进去
    3.png
    点击add ssh key
    5、在git中输入命令:
    ssh -T git@github.com
    然后会跳出一系列提问
    输入命令:yes
    回车
    嗯嗯,这样就可以了
    感叹:小白踩坑的辛酸史就先讲到这里了,预知后事如何,请听下回分解

    相关文章

      网友评论

          本文标题:IDEA-have the correct access rig

          本文链接:https://www.haomeiwen.com/subject/fgemgctx.html