1
我在远程访问的机器上使用git(github)时遇到了一些问题。我通过ssh从家里登录到我的工作计算机上。通过远程机器连接到github的ssh密钥问题
[email protected]$ ssh [email protected]
之后,我尝试通过家庭对工作计算机上的github执行pull或push请求,例如,
[email protected]$ git pull origin branch
后,我收到错误:
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我试图从我的工作电脑加载SSH密钥使用:
[email protected]$ eval "$(ssh-agent -s)"
[email protected]$ ssh-add ~/.ssh/id_rsa
但仍没有运气。当我在工作计算机上工作时,我可以向github发出请求而不出现任何问题;所以它似乎与我的ssh会话的ssh密钥的状态有关的问题。
感谢您的帮助!
验证您在workViaHome上添加的私钥实际上是您在github上添加的公钥的正确密钥。还要验证〜/ .ssh目录的访问权限是否正确。最后,尝试使用与git相同的用户/端口对github执行ssh操作,并添加详细标志以获取更多信息。 – DusteD
所以我孤立了这个问题,以ssh-add不触发git使用〜/ .ssh/id_rsa键,它仍然尝试使用默认键。我现在被骗了,因为我在github上添加了默认密钥并且它可以工作。我用ssh -vT [email protected]弄明白了。我仍然不确定为什么ssh继续回落到默认密钥 – BenJ