I followed the tutorial here to set up ssh for github in cygwin on Window 7. However, every time I do git push origin master
, I keep being prompted the following:
Enter passphrase for /cygdrive/c/Users/mynameis/.ssh/id_rsa:
This is so annoying because it beats the purpose of setting up ssh in the first place. I don't understand why it keeps prompting me for a password because when I did the same thing with my Mac and everything just worked fine and smooth.
I tried other solutions like: adding eval ssh-agent -s
into my .bashrc
. But the problem still remains. I suspect the problem has to do with ssh-agent
or ssh-add
in cygwin on Window 7. How can I get around this problem ?
Add the following to your ~/.bash_profile
. When bash starts, this does two things: 1. starts the ssh-agent (otherwise it might spawn and die for each push/pull) and 2. tells the agent to remember your passphrase. In some Linux distributions, this happens automatically, unfortunately that isn't the case with Cygwin.
## only ask for my SSH key passphrase once!
#use existing ssh-agent if possible
if [ -f ${HOME}/.ssh-agent ]; then
. ${HOME}/.ssh-agent > /dev/null
fi
if [ -z "$SSH_AGENT_PID" -o -z "`/usr/bin/ps -a|/usr/bin/egrep \"^[ ]+$SSH_AGENT_PID\"`" ]; then
/usr/bin/ssh-agent > ${HOME}/.ssh-agent
. ${HOME}/.ssh-agent > /dev/null
fi
ssh-add ~/.ssh/id_rsa
See also:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With