Issue
Hello I am facing issue to use git push origin master
or git pull origin master
because my remote origin is using SSH to connect, I have already setup SSH key pair configurations I also check this solution but it is not working for me. To test connection I issued following command on Ubuntu
ssh -T [email protected]
and it shows the following message
Hi zain! You've successfully authenticated, but GitHub does not provide shell access.
I am confused if my authentication is working with the SSH test command then why it is not working with push or pull procedure
Error is following
[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.
Solution
because I mapped the ssh key in config file so i assume it is loading correct private file
Make sure your remote URL is actually using that .ssh/config entry, and the right private key.
Try:
GIT_SSH_COMMAND='ssh -Tv' git push
And see what exact key is used.
If you have a .ssh/config like:
Host gh
Hostname github.com
User git
IdentityFile ~/.ssh/mykey
Your URL should be:
gh:<me>/<myrepo>
loading correct private file
An ssh-agent
is only needed of your private key is passphrase-protected, and has nothing to do with the ~/.ssh/config
file
.
Answered By - VonC