I'm on windows/Git bash/MingW64, trying to automate adding ssh keys for use with git. I've followed this guide, altering only the path of my private key file. It seems to work - when opening git bash I get "succeeded Identity added: /c/users/...".
ssh-add -l
also shows that my key was added properly, and the port seems to be configured.
Btw - At this point $SSH_AGENT_PID
matches the process in ps
and $SSH_AUTH_PORT
seems valid (/tmp/ssh-cEU4wbNe3vo4/agent.927
or similar)
But when I cd into my git repo and run git fetch
I get:
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
After that, ssh-add
no longer works, printing:
Error connecting to agent: Bad file descriptor
Which is strange because both $SSH_AUTH_PORT
and $SSH_AGENT_PID
Did not change at this point, and I've tried export
ing them just to be sure.
Starting a new SSH-AGENT and adding my key works in the same terminal session, but trying git fetch
again will have the same effect.
What is git doing that's messing with the SSH agent?