Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is this scenario possible:

  1. Using putty/pageant to connect via SSH to a remote linux server (ubuntu)?
  2. In the shell on the remote linux server doing "git push origin master" to github (url = git@github.com:username/repo.git and authenticating with the key I used to login to the linux server? (avoiding to have the key in ~/.ssh/id_dsa/id_rsa) ?
share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

Yes, that is possible and called SSH Agent Forwarding.

The nifty thing is, you can selectively let remote servers access your local ssh-agent as if it was running on the server. This is sort of like asking a friend to enter their password so you can use their computer.

share|improve this answer
    
Wow quick and elegant answer +1. I liked this this comprehensive illustrated guide unixwiz.net/techtips/ssh-agent-forwarding.html –  amotzg Aug 1 '12 at 13:13
    
something is missing.. debug1: Host 'github.com' is known and matches the RSA host key. debug1: Found key in /pat/.ssh/known_hosts:24 .. debug1: Authentications that can continue: publickey debug1: Next authentication method: publickey debug1: Trying private key: /pat/.ssh/identity debug1: Trying private key: /pat/.ssh/id_rsa debug1: Offering public key: /pat/.ssh/id_dsa debug1: Authentications that can continue: publickey debug1: No more authentication methods to try. ~/.ssh/config: Host github.com ForwardAgent yes putty: screencast.com/t/CVYgqk4Z2SnH –  perler Aug 1 '12 at 17:07
    
Ok, maybe I phrased my question wrong. I'm not talking about this scenario: unixwiz.net/techtips/ssh-agent-forwarding.html#fwd where the connection to server2, in this case github, is issued at the "home pc". the connection is issued from the server to server2 out of an ssh session which was previously established from the homepc to the server. should this be possible too? –  perler Aug 2 '12 at 8:09
    
Ok, solved it. This is something I stumble over from time to time, it's the darned "screen" window manager. as when opening a new screen window (ctrl-a c) parts of the environment is appearently not reread, the changes in the config to make this all happen are not yet active. so, the easiest is to do a "killall screen" which kicks you out of the server and reestablish the connection to the server, start a new screen session and now everything works. –  perler Aug 2 '12 at 8:31
    
@perler I'm exactly talking about the situation where you connect from "home" to a "server" and this server talks to GitHub, but using your home's SSH key. This is also what the GitHub manual explains. –  slhck Aug 2 '12 at 8:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.