Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot push to git repository - permission denied

I have a following problem:

$ git push -u origin master Permission denied (publickey). fatal: Could not read from remote repository.  Please make sure you have the correct access rights and the repository exists. 

I have already checked the connection doing this:

$ ssh -vT [email protected] 

and output looks good, I was correctly authenticated.

While checking further, I noticed that:

$ ssh-add -l The agent has no identities. 

I have tried to run ssh-agent, but nothing changed:

$ ssh-agent SSH_AUTH_SOCK=/tmp/ssh-A1mhFqvqncuO/agent.766; export SSH_AUTH_SOCK; SSH_AGENT_PID=767; export SSH_AGENT_PID; echo Agent pid 767; $ ssh-add -l Could not open a connection to your authentication agent. 

I am using Arch Linux. Any help would be strong appreciated! Thanks in advance!

Github diagnostic help here.

like image 425
mc.suchecki Avatar asked Dec 02 '12 22:12

mc.suchecki


People also ask

How do I fix Permission denied in git?

In terminal enter this command with your ssh file name pbcopy < ~/. ssh/id_rsa. pub This will copy the file to your clipboard Now open you github account Go to Settings > SSH and GPG keys > New SSH key Enter title and paste the key from clipboard and save it. Voila you're done.

How do I fix remote Permission denied in GitHub?

go to KeyChain Access, Search for "GitHub", then when then result "github.com" pops up, change the account or password to your new account, and save.

Why is git push being rejected?

A commit gets rejected and causes a failed to push some refs to error because the remote branch contains code that you do not have locally. What this means is that your local git repository is not compatible with the remote origin. Based on the above, your local machine is missing commits C and D.


1 Answers

I had the similar problem and my problem was solved by running the following command to add my key to the list of known keys:

ssh-add ~/.ssh/id_rsa 

Hope it solves yours too. ;)

like image 52
NEO Avatar answered Oct 03 '22 23:10

NEO