简体   繁体   中英

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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM