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

I've been using ssh for svn for a while now, but suddenly this strange thing happen

First, running svn up would just do, wonderfully.

Later, running svn up prompted me for a password, the suggested solution was to do sudo ssh-add ~/.ssh/* and then executing the update. Not very painful, but not so fun either.

Now, even that won't work. It says:

Could not open a connection to your authentication agent.

So the actual way of making this work is:

exec ssh-agent bash

sudo ssh-add ~/.ssh/*

svn up

Is there a way I can avoid doing all that stuff ?

Thanks a lot

share|improve this question

2 Answers 2

up vote 5 down vote accepted

Just put this line into your .profile:

eval `ssh-agent -s`

And it'll be taken care of automatically whenever you open a shell.

You could put the ssh-add command in there too, but I recommend doing that manually so that you can keep your private key passphrase-encrypted.

share|improve this answer
    
mm this doesn't work, still asks for the passphrase (which is empty) and after pressing enter it asks for a password :( –  Pablo Fernandez Nov 11 '10 at 19:07
    
Just to verify you followed my instructions correctly: are you seeing an "Agent PID 12345" message when you start the shell, and does running 'env' show SSH_AUTH_SOCK and SSH_AGENT_PID set? If you aren't, try moving the ssh-agent line from .profile to .bashrc: maybe your terminal isn't a login shell. –  dfranke Nov 11 '10 at 19:09
    
I put that on my .profile and I'm seeing the Agent PID ### stuff. I have both variables you mention defined. –  Pablo Fernandez Nov 11 '10 at 19:22
    
Then check the output of 'ssh-add -l' and make sure the relevant key is loaded into the agent. If it is, and this approach doesn't work while the commands you listed in your question do, then I have no idea what to tell you. –  dfranke Nov 11 '10 at 19:24
    
Why, by the way, are you running the ssh-add command under sudo? Is there some reason that those keys aren't readable by the user you're running svn under? –  dfranke Nov 11 '10 at 19:24

You can also run svn through apache. That way you will only need to do the ssh-agent/ssh-add prior to starting apache.

You can then access svn through https.

share|improve this answer

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.