Git--ssh

来源:互联网 发布:钢管舞教学视频软件 编辑:程序博客网 时间:2024/06/05 19:23

当你想要添加远程库时,输入命令
$ git push -u origin master

出现:
Warning: Permanently added the RSA host key for IP address ‘192.30.255.112’ to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

解决办法:
首先,清除所有的key-pair 命令:ssh-add -D
删除你在github中的public-key 命令:rm -r ~/.ssh
(或者直接找到 .ssh 文件夹 直接删除)

重新生成ssh密钥对 命令:ssh-keygen -t rsa -C “xxx@xxx.com”
后面一直按照默认回车
接下来正常操作在github上添加公钥 : 打开id_rsa.pub(建议用notepade++打开 ) 复制 粘贴

然后就正常操作
git remote add origin git@github.com:xxx/xxx.git
git push -u origin master

原创粉丝点击