GIT push: permission denied (public key)
git push origin testbranch
Permission denied (publickey).
fatal: Could not read from remote repository.
Where and how do we define public / private keys?
git remote -v returns:
origin [email protected]:Sesamzaad/NET.git (fetch)
origin [email protected]:Sesamzaad/NET.git (push)
—
I was facing same problem, here is what I did that worked for me.
Use ssh instead of http. Remove origin if its http.
git remote rm origin
Add ssh url
git remote add origin [email protected]:/.git
Generate ssh key inside .ssh/ folder. It will ask for path and passphrase where you can just press enter and proceed.
cd ~/.ssh
ssh-keygen -t rsa -C “[email protected]” || ssh-keygen (if GIT is INSTALLED)
Copy the key. You can view your key using. If you hadn’t specified a different path then this is the default one.
cat ~/.ssh/id_rsa.pub
Add this key to your github account. Next do
ssh -T [email protected]
You will get a welcome message in your console.
cd into to your project folder.
git push -u origin master
now should Work
<hr />
Further Issue : id_rsa , id_rsa.pub
Check that you are connecting to the right SERVER
TEST ssh -vT [email protected]
Alwasy use the git user
ssh -T [email protected]
permission may be denied (publickey)
Making sure the KEY is being USED!
eval “$(ssh-agent -s)”
WIll generate an ID > Agent pid 00000
Leave A Comment?