无法在 ssh 终端会话中推送到 github(Ubuntu ssh-agent over ssh)



有时我忘了把一些东西推送到家用电脑上的github,所以我用SSH快速登录并推送它。但我总是遇到这样的错误:

$ git push
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

我打开了X11转发,但仅此而已!当我在家的时候公钥就可以工作,为什么它会抱怨公钥?

github存储库如下:git@github.com:skerit/alchemy.git

它也只能在github上失败。其他的,私有存储库也可以正常工作。

我现在的解决方法是创建一个vnc会话并像那样推送它,但这很烦人。

第1版:

Ubuntu的ssh代理似乎以某种方式绑定到了Unity会话,任何没有从那里派生出来的进程都无法访问它。这很烦人。

 3123 ?        Ss     0:00 /usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-session /usr/bin/im-launch gnome-session --session=ubuntu

第2版:

我找到了一种使用现有ssh代理的方法,虽然它确实加载了现有的密钥,但它仍然不起作用。

https://superuser.com/questions/141044/sharing-the-same-ssh-agent-among-multiple-login-sessions

如果您的"不在家"机器有SSH密钥和正在运行的代理,则在连接到您的家庭机器时可以使用代理转发。尝试ssh选项-A或将ForwardAgent设置为Yes。详见man sshman ssh_config

最新更新