有时候我忘了在家用电脑上把东西推到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会话并像这样推送它,但这很烦人。
EDIT1:
Ubuntu的ssh-agent似乎以某种方式绑定到Unity会话,并且任何没有从那里生成的进程都无法访问它。这很烦人。
3123 ? Ss 0:00 /usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-session /usr/bin/im-launch gnome-session --session=ubuntu
EDIT2:
我找到了一种使用现有ssh-agent的方法,虽然它确实在现有密钥中加载,但它仍然不起作用。
https://superuser.com/questions/141044/sharing-the-same-ssh-agent-among-multiple-login-sessions
答案 0 :(得分:0)
如果您的“不在家”机器有SSH密钥并且代理正在运行,则您可以在连接到家用机器时使用代理转发。尝试使用ssh选项-A
或将ForwardAgent
设置为Yes
。有关详细信息,请参阅man ssh
和man ssh_config
。