您的位置:首页 > 其它

git免密码提交拉取 和 拉取时候出现权限错误 的解决办法

2016-07-27 17:56 387 查看
如果使用git拉取的时候出现这个错误(之前使用的时候重来没有出现过的)--但是要输入账号密码:

git pull 出错 fatal: Could not read from remote repository.Please make sure you have the correct access rights.and the repository exists.



解决办法在gitOS上加入秘钥 :


SSH Keys

SSH key 可以让你在你的电脑和 Git @ OSC 之间建立安全的加密连接。

你可以按如下命令来生成sshkey

ssh-keygen -t rsa -C "xxxxx@xxxxx.com"# Creates a new ssh key using the provided email
# Generating public/private rsa key pair...


查看你的public key,并把他添加到 Git @ OSC http://git.oschina.net/keys
cat ~/.ssh/id_rsa.pub
# ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6eNtGpNGwstc....


添加后,在终端(Terminal)中输入

ssh -T git@git.oschina.net


若返回

Welcome to Git@OSC, yourname!


则证明添加成功。

此时,不用输入账号密码也可以拉取提交,同时也以上出现的错误也就解决了!!!!!

注意:gitOS参考帮助  链接 :http://git.oschina.net/oschina/git-osc/wikis/%E5%B8%AE%E5%8A%A9#ssh-keys
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: