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

Nazmus Sakib
Programming Note
Published in
1 min readMar 4, 2021

--

fatal: Could not read from remote repository

As a programmer, you may encounter many errors. First, you have to read the error message carefully. Because error messages usually tell you what to do to get rid of this.

When you get the error message from your git CLI, this means your local machine has a problem with Github's shh keys so the solution is:

  1. Open the .git folder in your project directory(it's a hidden folder so make sure to check that you are able to view hidden files and folders on your computer)
  2. Open config file using notepad or your favorite code editor
  3. Here you will edit the line with url = git@github.com:username/repo and replace it with your repository URL(can be found on Github under https when you click the green “code” button). it should look like this url = https://github.com/username/repo save then try to push your code to GitHub. this will prompt you to log in and that should fix the issue since your ssh keys have been updated.

Happy Coding…

--

--