GitHub Error Message - permission denied (publickey). fatal: could not read from remote repository.

716    Asked by Deepabhawana in Python , Asked on Apr 8, 2021

Has anybody seen this error and know what to do?

I'm using the terminal, I'm in the root, the GitHub repository exists and I don't know what to do now.

> 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.

Answered by Deepa bhawana

permission denied (publickey). fatal: could not read from remote repository Did you face this error while coding. Don’t Panic! Here is the solution for you.


Step 1: First, create the SSH keys by utilizing the following command:

  $ ssh-keygen -t rsa -C "your_email@example.com"

It will create both id_rsa and id_rsa.pub files for you

Step 2: Now add the id_rsa to ssh list on local computer using the following command:

  $ ssh-add ~/.ssh/id_rsa.

Step 3: After generating the keys get the pubkey using:

  $ cat ~/.ssh/id_rsa.pub

You will get to see something like :

ssh-rsa AAAB3NzaC1yc2EAAAADAQABAAACAQCvMzmFEUPvaA1AFEBH6zGIF3N6pVE2SJv9V1MHgEwk4C7xovdk7Lr4LDoqEcqxgeJftwWQWWVrWWf7q9qCdHTAanH2Q5vx5nZjLB+B7saksehVOPWDR/MOSpVcr5bwIjf8dc8u5S8h24uBlguGkX+4lFJ+zwhiuwJlhykMvs5py1gD2hy+hvOs1Y17JPWhVVesGV3tlmtbfVolEiv9KShgkk3Hq56fyl+QmPzX1jya4TIC3k55FTzwRWBd+IpblbrGlrIBS6hvpHQpgUs47nSHLEHTn0Xmn6Q== user@email.com

Step 4: Now all you require to do is copy this key (value) and go to github.com and under the setting (ssh and pgp key) add your public key.


Your Answer

Interviews

Parent Categories