Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Hey, I'm connecting to a remote server via PuTTy. On this server, I also work on some code, which I would like to push to a git repository, which needs ssh-rsa authentication.

So when pushing

git push origin master

the server asks for a password. However, I have loaded my private key with pageant, so PuTTy should actually know my private key and not ask for a password but just directly accept the push.

My main question: How is the standard procedure if you want to git-push to a remote server that requires authentication (the user having a valid private key) over PuTTy?

To upload my key to the server would of course not be a good option.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

You need to enable agent forwarding in PuTTy. In the Putty configuration, navigate to Connection -> SSH -> Auth and check "Allow Agent dorwarding"

EDIT: After enabling agent forwarding in PuTTy and SSHing to a system that has your public key, you will be able to ssh from that system into a second system that also has your public key. You will not need to do anything special to make this work. You do not need to enable agent forwarding when you connect to the second system (either with -A or with ForwardAgent Yes in your ~/.ssh/config). You only need to enable agent forwarding when you are going to make another hop from the system you are logging into.

When you connect from your computer to the server you are going to make another hop (using git), so you must enable agent forwarding. When git connects via ssh to another server, it isn't going to make another hop, so you don't need to enable agent forwarding.

If you'd like to understand how agent forwarding works, look at the excellent Illustrated Guide to SSh Agent Forwarding.

share|improve this answer

The key in pageant are known to PuTTy, but the git code is running an ssh client on the remote server, not on your desktop so you will either need to create a key-pair to use for pushing code or login via a password.

share|improve this answer
    
This is correct. Note that you need to upload your public key to the server, not your private one. –  Chris May 13 '11 at 15:10
    
I confess I initially thought this too, but it should be very possible for pageant to extend it's authentication over many subsequent ssh connections, so long as each subsequent connection is setup to allow it. –  Gavin C May 13 '11 at 15:11
    
@Chris: I'm familiar with public key crypto :) –  ptikobj May 13 '11 at 15:18

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.