Search code examples
gitgithubcygwinmsysgitmintty

Able to push, fetch but not pull


So I just spent ~ 4 hr trying to get an repo working under an SSH URL on windows, I'm almost there, but I run into this weird issue.

I am able to use

git push origin master
git fetch origin master
ssh git@github. #tells me authentication is successful but shell access is not allowed

and all the local commands. However, when I try to do git pull, I get:

-bash-4.1$ git pull
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
-bash-4.1$

I do have id_rsa and id_rsa.pub under %HOME%/.ssh and the public key is added to my GitHub account. My git URL is also correct.

EDIT

-bash-4.1$ git --version
git version 1.8.5.2.msysgit.0

Solution

  • The problem may be persisting because git and cygwin have different .ssh directories.

    When you do ssh git@github it uses the one specified in .ssh folder of cygwin, but when you do a git pull it uses the id_rsa present in git bash's .ssh folder.

    See my question => ssh clone not cloning repo in git