我有一个公钥/私钥 rsa key 对。我可以使用 ssh 连接到远程服务器,但是当我执行 git pull origin master
时,我收到此错误:
Permission denied (publickey,gssapi-keyex,gssapi-with-mic). fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
我的 git 客户端运行 ubuntu 14.04
,我的公私钥在文件夹 $HOME\.ssh
中。
我尝试执行 sudo chmod -R 777 folder
但没有成功。
最佳答案
sudo chmod -R 777 folder but without any success.
那是行不通的,因为任何具有写入权限的文件夹都会使 ssh 立即失败。
您需要确保:
您已正确生成 ssh key 对:
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
(我建议一开始不要设置密码,至少为了测试)
与您的 ~/.ssh/id_rsa(.pub) 的正确关联是正确的。
至少:chmod 700 /home/<login>/.ssh chmod 600 /home/<login>/.ssh/authorized_keys
ssh url 正确。
例如,GitHub 将使用 git@github.com:user/repo您的 ssh key 已注册到您的帐户 (Example for GitHub)
关于git 权限被拒绝(公钥、gssapi-keyex、gssapi-with-mic),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37624386/