Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bitbucket/Github: permission denied public key

when I am trying to clone a rails app repo I have got permission to, I am getting this issue.

Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Even after adding public key by generating one, I am unable to solve this.

Although I am able to clone using he https method but after making changes, the same error comes while I try to push the code.

Please suggest an answer for this.

like image 755
Suraj Avatar asked Sep 06 '25 11:09

Suraj


1 Answers

First, cd into your .ssh directory. Open up the terminal and run:

cd ~/.ssh && ssh-keygen

Second, you need to copy this to your clipboard:

 cat id_rsa.pub | pbcopy # On OSX
 cat id_rsa.pub | xclip # On Linux

Third, add your newly generated ssh key to your account via the github/bitbucket website (just paste there).

Next, setup your git config:

git config --global user.name 'your_user_name'
git config --global user.email 'your_email'

Finally, restart your command line to make sure the config is reloaded.

Now, you should be able to clone and push from/to your github repository.

For more information on this, see this github page or this bitbucket page.

like image 195
K M Rakibul Islam Avatar answered Sep 08 '25 06:09

K M Rakibul Islam