0

I am using git bash and also git client source tree on windows I can do near all git things on bash which are possible on source tree but I am unable to push and or pull from bash when I try to push or pull I always get error. Can some please help me on this? Might this information can help, I work on a private repository using ssh (Private, public key).

Getting error for git pull or push

$ 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.

1
  • Make sure your public key (id_rsa.pub) is added in your GitHub account. Have you did this? Commented May 24, 2017 at 11:00

2 Answers 2

3

I think you have issue of plink.exe.

you have to download putty-64bit-0.68-installer.msi or compactable version
From

https://www.ssh.com/ssh/putty/download

When installation is done please find the location of installed putty folder in my case its C:\Program Files\PuTTY

Now you have to create a system variable

GIT_SSH='C:\Program Files\PuTTY\plink.exe' 

Now open a new terminal and try to push but before pushing make sure you have added private key in pageant

If you don't have pageant.exe not worry it come with aboove msi pack, You can go to the installed location("C:\Program Files\PuTTY\plink.exe") and run pageant.exe

Helpful link: http://guides.beanstalkapp.com/version-control/git-on-windows.html

Sign up to request clarification or add additional context in comments.

2 Comments

This makes no sense given the specified error. G4W is bundled with an Msys distribution that includes OpenSSH; using PuTTY as the SSH client is entirely unnecessary. The specific error that the OP reports is that the SSH key exchange is failing, which almost always points to a misconfigured public key on the repository server.
SourceTree includes a copy of plink and starts it automatically when it launches (this is why it works in SourceTree), so the key thing here would be the GIT_SSH environment variable.
3

Afair Sourcetree uses some dedicated SSH key for accessing repositories. If you use Git Bash, this is not the SSH key that is used and thus you don't have access.

Either add the SSH key you are using from Git Bash to your account too so that both SSH keys work or copy the SSH key Sourcetree is using and use it instead of the other one.

2 Comments

How does one add SSH Key. Can you give details?
Depends on the repository hosting. If you e.g. just have it available via regular SSH on some own server, you add it to the authorized_keys file. If you use something like GitHub, there are settings in your profile where you can add additional keys.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.