DEV Community

Rahul Wagh
Rahul Wagh

Posted on • Originally published at jhooq.com

How to fix github permission denied publickey fatal could not read from remote repository?

This issue is pretty common when you are trying to clone your GitHub repo using the SSH .i.e. - git@github.com:rahulwagh/jhooq-master.git.

There are a couple of ways to fix this issue -

  1. Using the HTTPS URL provided by the GitHub
  2. By generating the SSH public keys and uploading the public SSH keys to GitHub.

  3. Using the HTTPS URL provided by the GitHub

In this approach, we are going to use the GitHub URL which starts with HTTPS for example - https://github.com/rahulwagh/jhooq-master.git. Using the HTTPS URL you have to provide the username and password to authenticate yourself and once you are authenticated then you can easily clone the GitHub repository.

  1. By generating the SSH public keys and uploading the public SSH keys to GitHub

The second approach is a little long but it is the most recommended and secure way to clone your repository. For generating the SSH keys you need to use the ssh-keygen to generate your public SSH-key .i.e. - id_rsa.pub. After generating the ssh-key you need to upload the key to GitHub account SSH and GPG keys section.

Read more on troubleshooting steps - https://jhooq.com/github-permission-denied-publickey/

Top comments (0)