Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have an Ubuntu Server 10.04 installation on Linode. I am trying to use ssh-agent to stop typing my passphrase everytime I need to push some changes to GitHub. I am using the script provided by GitHub here. But when I source my .zshrc file or when I logout and log back in I get the following error message:

Could not open a connection to your authentication agent.
Error: Can't open display: (null)

Does anyone know what the the problem might be and how I could fix it please?

share|improve this question
    
There's something wrong in your .zshrc. Line 47, I think (unless my crystal ball's gone misaligned again). Post your .zshrc, and try adding set -x at the beginning to see a trace of what it's doing. –  Gilles Feb 28 '11 at 22:25
    
here is my .zshrc: pastie.org/1621083 –  Aziz Light Mar 1 '11 at 15:51
add comment

2 Answers

Your .zshrc may be modifying the DISPLAY variable, or modifying access to the screen. Normally ssh-agent is started when you start gnome. The variable SSH_AUTH_SOCK is set to the socket of your ssh-agent. If this variable is set, then ssh-agent will try to open window to get the password for your key when it is needed.

If your display is not accessible you can use ssh-add to add the key from the command line. Do this after you reboot. You also need to repeat this if your key ages out.

share|improve this answer
    
Thanks for your answer. It solves one part of the problem, which is that the second error message (Error: Can't open display: (null)) is unrelated to ssh-agent. It's related to oh-my-zsh. On the other hand, still don't know why ssh-agent fails (and why I get the first error message), but it might also be because of oh-my-zsh. –  Aziz Light Feb 28 '11 at 7:15
add comment

Sounds like ssh-agent is not running when you source the file. You have lines 46 and 47 commented out:

# eval `ssh-agent`
# ssh-add ~/.ssh/id_rsa

Try uncommenting those lines.

share|improve this answer
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.