Getting past the git permission denied error

errorslessonsphp

Written by:

Reading Time: 1 minute

Have you ever been delayed by that annoying error which prompts you to share a public key with a git repo ? I have, and I am sure you have too.

Below is a 3 step process that would sort you out in a giffy, and get you back on the road to finishing that app.

The problem usually reads something like this;

Permission denied (publickey).
fatal: Could not read from remote repository.Please make sure you have the correct access rights and the repository exists.

 

What you should do ?

1. In your bash terminal, run

ssh-keygen -t rsa -C “youremail.email.com”

 

For example;

ssh-keygen -t rsa -C “eli.anthony.agbenu@gmail.com”

 

2. Next run

cat ~/.ssh/id_rsa.pub

Copy the gibberish text that shows up.

3. Next,  share it with your git repo. For example, if you use bitbucket, navigate to SSH keys, and click create a new key. And click save.

That is all there is to it. Now re-run the command you wanted to execute before you encountered the permission denied error.

As you can see, it works now. Hope this short post helps someone out there.

Cheers.

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll Up