ssh-agent doesn't work / save me from typing p

2019-06-13 19:25发布

问题:

After running

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

and entering my passphrase, git still prompts me to enter the passphrase every time I perform a remote action.

To illustrate:

bash-4.1$ echo $SSH_AUTH_SOCK
/tmp/ssh-cWNDloIzZkhW/agent.5560
bash-4.1$ ssh-add -l
2048 <fingerprint> /cygdrive/c/Users/<username>/.ssh/id_rsa (RSA)
bash-4.1$ git pull
Enter passphrase for key '/cygdrive/c/Users/<username>/.ssh/id_rsa':

回答1:

The problem turns out to be that git was using cygwin's ssh, which looks at a different /tmp than git does. I previously renamed the ssh under /git/bin since I thought it caused issues. Renaming it back made everything work.