Question

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
Was it helpful?

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

OTHER TIPS

Here is how I solved my problem:

Create a file named config file under cygwin64/home/<username>/.ssh

Add line IdentityFile <path to your private key> to it

Are you perhaps pulling from a different location?

Try:

git pull origin master
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top