I'm using cygwin as my terminal on Windows 7. I have found several suggestions to run ssh-agent in cygwin so I don't have to enter my password every time I run a git fetch/pull/push. I added the following to my .bash_profile and restarted my cygwin session:
SSH_ENV="$HOME/.ssh/environment"
function start_agent {
echo "Initialising new SSH agent..."
/usr/bin/ssh-agent -s | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo succeeded
chmod 600 "${SSH_ENV}"
. "${SSH_ENV}" > /dev/null
/usr/bin/ssh-add;
}
# Source SSH settings, if applicable
if [ -f "${SSH_ENV}" ]; then
. "${SSH_ENV}" > /dev/null
#ps ${SSH_AGENT_PID} doesn't work under cywgin
ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
start_agent;
}
else
start_agent;
fi
It looks as if the ssh-agent and ssh-add are run successfully, but I am still prompted for my password.
Initialising new SSH agent...
succeeded
Enter passphrase for /cygdrive/c/Users/<username>/.ssh/id_rsa:
Identity added: /cygdrive/c/Users/<username>/.ssh/id_rsa (/cygdrive/c/Users/<username>/.ssh/id_rsa)
$ ssh-add -l
2048 <fingerprint> /cygdrive/c/Users/<username>/.ssh/id_rsa (RSA)
$ git fetch --all
Fetching origin
Enter passphrase for key '/c/Users/<username>/.ssh/id_rsa':
I am in fact using SSH and not HTTPS for my git connection (redacted private info):
$ git remote -v
origin ssh://git@XXX/XXX.git (fetch)
origin ssh://git@XXX/XXX.git (push)
The closest problem I've found for this issue is the following question:
ssh-agent doesn't work / save me from typing passphrase for git
However, I didn't rename my ssh under /git/bin.
Any suggestions on how to diagnose this issue? Thanks!
~/.ssh/config
looks like? – Corie/cygdrive/c/Users/<username>/.ssh/id_rsa
, but the git one is/c/Users/<username>/.ssh/id_rsa
. How do I make these match? – Talia