SSH Agent Forwarding not working

邮差的信 提交于 2019-11-29 20:18:58

Do you have your ssh key added to the list of agent identites ?

You can check with ssh-add -L , you should see the key your are using to connect to github :

$ ssh-add -L
ssh-rsa AAAAB3N.....0VmSiRvTzBrbU0ww== /Users/youruser/.ssh/id_rsa

If you don't see the ssh key you use for github or a message like

The agent has no identities.

Then you should add your key with :

ssh-add ~/.ssh/id_rsa

(replace with the path to the key you use for github)

See the ssh-add doc for more info

Add following lines to .ssh/config file on your local computer

  Host Server_Address
     ForwardAgent yes

Check your local key whether listed in ssh-add list or not with

ssh-add -L

If not add key to SSH Agent

ssh-add -K

Connect to Remote Server

ssh -v username@Server_Address

Check SSH Agent forwarding is enabled by running following command. It should list a socket file

echo "$SSH_AUTH_SOCK"

Run connection test against GitHub

ssh -T git@github.com

Run ls remote test against targeted git repository

git ls-remote --heads git@github.com:account/repo.git

Finally logout and run following from your local machine

cap production git:check

Add the following to ~/.ssh/config

Host one-of-my-servers.com
    ForwardAgent yes

If you add the ssh key and then quit terminal, you have to re-add it again the next time you open terminal.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!