3

I'm trying to set up Agent Forwarding on my MacBook Air running Mountain Lion.

Locally, I can run ssh -T git@github.com and I successfully connect to github.

When I try to ssh to my server and run ssh -T git@github.com, it says permission denied.

Here's ~/.ssh/config

Host <my host>
  ForwardAgent yes

Output of ssh -v <my server>

debug1: Reading configuration data /Users/tombleymaier/.ssh/config
debug1: /Users/tombleymaier/.ssh/config line 1: Applying options for <host>
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to <host> [<ip>] port 22.
debug1: Connection established.

/etc/ssh_config (line 20+)

 Host *
   SendEnv LANG LC_*
#   ForwardAgent no
#   ForwardX11 no
#   RhostsRSAAuthentication no
#   RSAAuthentication yes
#   PasswordAuthentication yes
#   HostbasedAuthentication no
#   GSSAPIAuthentication no
#   GSSAPIDelegateCredentials no
#   GSSAPIKeyExchange no
#   GSSAPITrustDNS no
#   BatchMode no
#   CheckHostIP yes
#   AddressFamily any
#   ConnectTimeout 0
#   StrictHostKeyChecking ask
#   IdentityFile ~/.ssh/identity
#   IdentityFile ~/.ssh/id_rsa
#   IdentityFile ~/.ssh/id_dsa
#   Port 22
#   Protocol 2,1
#   Cipher 3des
#   Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc
#   MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160
#   EscapeChar ~
#   Tunnel no
#   TunnelDevice any:any
#   PermitLocalCommand no
#   VisualHostKey no
#   ProxyCommand ssh -q -W %h:%p gateway.example.com

I set this up on another MacBook running Mountain Lion without issue.

Tyler DeWitt
  • 23,366
  • 38
  • 119
  • 196
  • Once of your server, do you have the same keys (`~/.ssh/id_rsa`, `~/.ssh/id_rsa.pub`) than you had locally? If you don't have those key when ssh'ing to your server, you won't be able to complete the ssh to github. – VonC Aug 25 '12 at 08:47
  • 1
    @VonC - I thought the point of the forward agent was that the keys didn't have to be installed on the intermediate machine? – Tyler DeWitt Aug 27 '12 at 17:14
  • Right, I just re-read http://www.codegnome.com/blog/2012/08/26/remote-forwarding-with-ssh-and-git-daemon/ . What does a return `ssh -Tvvv git@github.com` executed on your server? – VonC Aug 27 '12 at 18:27

1 Answers1

5

Turns out the identity was being removed from the local ssh-agent of every reboot. Gotta run the ssh-add with a -k command: ssh-add -K ~/.ssh/privateKey.txt

From: SVN+SSH, not having to do ssh-add every time? (Mac OS)

Community
  • 1
  • 1
Tyler DeWitt
  • 23,366
  • 38
  • 119
  • 196