Search code examples
gitsshssh-agent

ssh-agent not working with git


On a fresh install of Cygwin (used git-bash before), I can't use ssh-agent with git.

ssh-agent is well configured, as ssh command works.

$ ssh [email protected]
PTY allocation request failed on channel 0
logged in as lenouveau.

You can use git or hg to connect to Bitbucket. Shell access is disabled.
Connection to bitbucket.org closed.

But when using git command, it doesn't seem to load my ssh key.

$ git fetch
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

git-gui works well.

With another terminal (ex: git-bash), it works too.

My .ssh folder :

$ ls -al ~/.ssh
total 38
drwx------+ 1 LeNouveau Aucun      0  3 juil. 11:39 .
drwxrwx---+ 1 Système  Système    0  3 juil. 11:37 ..
-rw-------+ 1 LeNouveau Aucun    133  3 juil. 11:39 agent.env
-rwx------+ 1 LeNouveau Aucun   1766 16 avr.  09:33 id_rsa
-rwx------+ 1 LeNouveau Aucun    402 16 avr.  09:33 id_rsa.pub
-rwx------+ 1 LeNouveau Aucun   3013 26 juin  14:34 known_hosts

What did I miss ?


Solution

  • Ok, found my mistake : I was using my windows command git (from git for windows) instead of the cygwin one.

    Uninstalling the Windows one and installing the cygwin one solved my problem.