Cygwin ssh key added, but Git permission denied (publickey)
For me, the cause is that I put my ssh key files in C:\Users\username\.ssh
(which is /cygdrive/c/Users/username/.ssh
in cygwin), but actually, you need to put your ssh keys in ~/.ssh
to make it work. They are two different directories.
Run the following command in cygwin solved my problem.
cp /cygdrive/c/Users/username/.ssh/* ~/.ssh/
Notice that you should replace username
with your actual one.
The agent does not have to be only running, but your tools have to know where is the agent listening. It is stored in variable $SSH_AUTH_SOCK
and if it works for you from one terminal, it does not have to from the second one.
If you want to have it working in your NetBeans, you need to inject this variable into the NetBeans environment variables (but not sure how to do that so it would be passed from windows environment to the Cygwin terminal in NetBeans).
Or inject it later into the running terminal (possibly using .bashrc
or other startup scripts). Simple test case would be to echo $SSH_AUTH_SOCK
in the MinGW terminal and then write export SSH_AUTH_SOCK=/the/path/you/got/from/previous/command
into the Cygwin terminal.
Later on you can automate it by storing the variable into some file, that you can read in the Cygwin.
# MinGW scriplet echo "export SSH_AUTH_SOCK=$SSH_AUTH_SOCK" >> ~/agent_env# Cygwin scriplet. ~/agent_env
Then you should be able to use your mingw agent from cygwin shell.