I have received the following error multiple times:
Could not read remote repository. Please make sure you have the correct access rights and the repository exists.
I am very confused about how to remedy this error.
asked Apr 26, 2013 at 21:37
3
Make sure you are using the correct SSH keys/usernames on both your GitHub account and your local machine. Here’s how you can
do that on GitHub
Also, you might consider using an alternative Git manager. I’ve never heard of Aptana, but I do know that GitHub has an awesome GUI program for managing your repositories.
In the future, this is all much easier and more streamlined on Linux/Unix operating systems like Ubuntu. Ubuntu is geared towards developers and has things like Git and SSH installed correctly by default.
answered Apr 26, 2013 at 21:57
I had the exact same issue with a private repo.
Cloning through the same error both through https and ssh
Then I made a commit through github (simply updated the README.md with an empty line)
Surprisingly enough, this resolved the issue. It would be nice to know why though!
answered Apr 25, 2016 at 14:26
Dimitris BaltasDimitris Baltas
3,0353 gold badges32 silver badges26 bronze badges
1
I had the same problem — it was caused by me using the SSH key instead of the HTTPS URL. I created my repository by importing a project via Intellij and it must have pushed via HTTPS.
answered Feb 27, 2017 at 18:08
ayahuascaayahuasca
53610 silver badges9 bronze badges
Assuming you have done the proper SSH keys configuration according to github’s instructions it might be a problem of pull with https and later pushing with git+ssh
to make it more clear
if you have used https to pull
git pull https://github.com/user/repo.git
then you have changed remote URL
git remote set-url origin git+ssh://github.com/user/repo.git
and tried to push after some changes and commits
git push origin master
you might get this error it happened to me
erase the local repository and re-clone using git+ssh
git pull git+ssh://github.com/user/repo.git
and now your push should work
answered Feb 1, 2017 at 19:12
GiorgosKGiorgosK
7,1972 gold badges30 silver badges26 bronze badges
ssh-add -A resolved my issue in MacOS Sierra 10.12.6.
I had no problem both for public and private repo before.
Today I tried to clone or git pull for private repo, but it hit the above issues.
After search around, this is the perfect solution for me.
answered Aug 22, 2017 at 8:31
1
On Windows open file:
C:Users<USER_NAME>.sshconfig
You should have your host defined in the «config» file:
host gitlab.com
HostName gitlab.com
IdentityFile ~/.ssh/id_rsa_user_private_key
host bitbucket.org
HostName bitbucket.org
IdentityFile ~/.ssh/id_rsa_user_private_key
host github.com
HostName github.com
IdentityFile ~/.ssh/id_rsa_user_private_key
answered Feb 5, 2019 at 13:33
BrljaBrlja
3643 silver badges14 bronze badges
2
Try these 3 Simple Steps:
It’s pretty straight forward. See the 3 step summary of the links below.
- Check for the existence of SSH keys. If one exists, then great: you can use it. If not, then you will have to create one.
- You will need to add the ssh key to the ssh-agent. If the agent is snoozing on the job, then you will need to wake the agent by writing this to your console/terminal:
eval $(ssh-agent -s). Then you can simply add the key, - Try pushing your repository. Hopefully it should work.
answered Sep 4, 2019 at 5:32
BenKoshyBenKoshy
32k14 gold badges103 silver badges78 bronze badges
I had same issue on my private Ubuntu server using ssh.
My workaround solution was:
open shell on my private server
git init --bare /path/<myapp>.git
and then, from my developer laptop
git push <remote_repo> <local branch>
has finally worked well.
PS:
I’ve never tried, but remote repo with https seems working better than ssh.
I hope this help.
answered Jan 26, 2017 at 8:01
rfellonsrfellons
65812 silver badges27 bronze badges
1
In addition to setting the identity files in the ssh config, I also had to set the git remote to the right user — complete solution in https://www.keybits.net/post/automatically-use-correct-ssh-key-for-remote-git-repo/
vi ~/.ssh/config
Host github.com-myuser
HostName github.com
User git
IdentityFile ~/.ssh/mykey
I made sure I had this identity file loaded with ssh-add -l
ssh-add -l
4096 SHA256:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX mykey (RSA)
Then I set my remote to include the right user
git remote set-url origin git@github.com-myuser:myuser/myrepo.git
Then the push worked
git push -u origin master
Enumerating objects: 146, done.
Counting objects: 100% (146/146), done.
Delta compression using up to 4 threads
Compressing objects: 100% (144/144), done.
Writing objects: 100% (146/146), 9.71 MiB | 7.48 MiB/s, done.
Total 146 (delta 10), reused 0 (delta 0)
remote: Resolving deltas: 100% (10/10), done.
To git@github.com-myuser:myuser/myrepo.git
* [new branch] master -> master
Voila
answered Jun 22, 2019 at 14:28
saranicolesaranicole
1,9231 gold badge21 silver badges23 bronze badges
1
answered Jan 6, 2017 at 16:11
Installing a root/CA Certificate
Given a CA certificate file foo.crt, follow these steps to install it on Ubuntu:
Create a directory for extra CA certificates in /usr/share/ca-certificates:
sudo mkdir /usr/share/ca-certificates/extra
Copy the CA .crt file to this directory:
sudo cp foo.crt /usr/share/ca-certificates/extra/foo.crt
Let Ubuntu add the .crt file’s path relative to /usr/share/ca-certificates to /etc/ca-certificates.conf:
sudo dpkg-reconfigure ca-certificates
This is an old post, but this is they only thing that I found that worked.
answered Feb 17, 2017 at 3:32
SolSol
9191 gold badge9 silver badges23 bronze badges
I also had the exact same error and for some reason restarting my pc solved the error. Maybe it works for somone else too 
answered Apr 19, 2017 at 11:59
If it’s a public repo, just clone using https. No need to use passwords or setup SSH keys.
answered May 18, 2018 at 11:43
CGFoXCGFoX
5,0107 gold badges44 silver badges79 bronze badges
if you want to push/pull any repository from local to remote(git hub)
first checkout
$ git push https://<git-hub url>
working fine with username and passwd credential
$ git push git@<git-hub url>
fail
Could not read remote repository. Please make sure you have the correct access rights and the repository exists.
this means you need to add id_rsa.pub to authorized_keys
goto
$ cd /home/admin/.ssh
$ls
$vi authorized_keys
add id_rsa keys(n no of keys you can add)
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEA0KJDLOiiXj9XdMxiCT9KvaKfuxFQi+CIiklaN5hHsNgYOu7TijqyONEu5fONLoAo/cshLa+KuargyTrtizwcP4TPcTXZhhJrM0GUDJragw7SMVIs/5xJBGAyHKJ1YUMGO7+nJTmsCLx6PFOlQYveuriiVVCCZerGCLH+UtSXK3z+l7hx9NiDg3/ylOLc3f3SLxrJKn0gMTgK7BHJFXo4PguuPjWZLVdUDX+XKiqtT2n4IsYs6N9qVFG3zUgNlEjZM47NK/ytAC0max98pK+QNzsuaQOo/IShJ1TOw5wwScflPArVJ2AyROqAe7cfQg7q12I9olASFd3U5NazfZCTYAvWA1kz9UZEWLJ1Br1XOkPqOleMM8KCp/PXzz8H0kISkMIji0/QuiZOPEBsKlszXjlALcXR8Mg1uiZVWy48i9JheyXyj1ToCj6cPScpgFHp3DAGSlKKbE1EFaVfeeyGAnHESlnDDg3Gq5xSsB9Okqm3V5t8GpFaJbV68BxQ4BK6HJ21A3CinV4LdV3hR/OBUbDG2EcI+ZKRDjlpJuu4YU= stace@pretend-machine
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAywWhrwq4FjHt+UuwZcZePxtjtZOENFpOjufycaYso2nTlzNwnAQEQRfbqsUxKVtOtGxgApIkUvjRIjNBdJE6iOzvBXZhhJrM0GUDJragw7SMVIs/5xJBGAyHKJ1YUMGO7+nJTmsCLx6PFOlQYveuriiVVCCZerGCLH+UtSXK3z+l7hx9NiDg3/ylOLc3f3SLxrJKn0gMTgK7BHJFXo4PguuPjWZLVdUDX+XKiqtT2n4IsYs6N9qVFG3zUgNlEjZM47NK/ytAC0max98pK+QNzsuaQOo/IShJ1TOw5wwScflPArVJ2AyROqAe7cfQg7q12I9olASFd3U5NazfZCTYAvWA1kz9UZEWLJ1Br1XOkPqOleMM8KCp/PXzz8H0kISkMIji0/QuiZOPEBsKlszXjlALcXR8Mg1uiZVWy48i9JheyXyj1ToCj6cPScpgFHp3DAGSlKKbE1EFaVfeeyGAnHESuXC9wkSeFZCEyMJ+RgJxMkBXNZmyycbwsSqAeGJpMEUDlwzu2GD0obBz0HXqg9J1Xallop5AVDKfeszZcc= stace@another-machine
:wq!
goto github-->settings--->ssh---->add new key---->id_rsa.pub
$git push git@<git-hub url>
L_J
2,29510 gold badges24 silver badges28 bronze badges
answered Aug 25, 2018 at 7:24
If you’re using SSH, make sure you’re using a network that allows SSH. Most public networks allow only HTTP(S) traffic.
answered Oct 15, 2018 at 15:03
0
Hi my problem was that my client did not ask if I recognized the key. Opening a terminal and doing ssh -T git@github.com worked. The response in the terminal asked if I wanted to add the key, I said yes and after that, my client worked fine
answered Jan 28, 2019 at 0:34
franksandsfranksands
1,69818 silver badges21 bronze badges
I had a similar issue, Until I realized, I was running my machine through a proxy address for my internet connection and it happens to close the host connection. This could be one of the few reasons too.
answered Feb 1, 2019 at 6:36
anshulanshul
5186 silver badges23 bronze badges
For me, I had followed all the steps mentioned in Adding new ssh key and rest of the auxiliary links related to this issue.
But the issue was network access. Solution — using VPN to access my Github Enterprise. (in my case Georgia Tech VPN for github.gatech.edu)
answered Apr 5, 2019 at 23:47
Chaitanya BapatChaitanya Bapat
3,0135 gold badges31 silver badges57 bronze badges
In my case, I generated new key pairs but forgot to update public key in github.com (settings).
answered Mar 15, 2020 at 3:09
viggy28viggy28
7109 silver badges21 bronze badges
A simple solution to this is delete the old ssh key from github/gitlab and add the same key again. This is easy work around and you have to hussle with anything
answered Sep 30, 2020 at 14:26
dumb_coderdumb_coder
3093 silver badges18 bronze badges
I have received the following error multiple times:
Could not read remote repository. Please make sure you have the correct access rights and the repository exists.
I am very confused about how to remedy this error.
asked Apr 26, 2013 at 21:37
3
Make sure you are using the correct SSH keys/usernames on both your GitHub account and your local machine. Here’s how you can
do that on GitHub
Also, you might consider using an alternative Git manager. I’ve never heard of Aptana, but I do know that GitHub has an awesome GUI program for managing your repositories.
In the future, this is all much easier and more streamlined on Linux/Unix operating systems like Ubuntu. Ubuntu is geared towards developers and has things like Git and SSH installed correctly by default.
answered Apr 26, 2013 at 21:57
I had the exact same issue with a private repo.
Cloning through the same error both through https and ssh
Then I made a commit through github (simply updated the README.md with an empty line)
Surprisingly enough, this resolved the issue. It would be nice to know why though!
answered Apr 25, 2016 at 14:26
Dimitris BaltasDimitris Baltas
3,0353 gold badges32 silver badges26 bronze badges
1
I had the same problem — it was caused by me using the SSH key instead of the HTTPS URL. I created my repository by importing a project via Intellij and it must have pushed via HTTPS.
answered Feb 27, 2017 at 18:08
ayahuascaayahuasca
53610 silver badges9 bronze badges
Assuming you have done the proper SSH keys configuration according to github’s instructions it might be a problem of pull with https and later pushing with git+ssh
to make it more clear
if you have used https to pull
git pull https://github.com/user/repo.git
then you have changed remote URL
git remote set-url origin git+ssh://github.com/user/repo.git
and tried to push after some changes and commits
git push origin master
you might get this error it happened to me
erase the local repository and re-clone using git+ssh
git pull git+ssh://github.com/user/repo.git
and now your push should work
answered Feb 1, 2017 at 19:12
GiorgosKGiorgosK
7,1972 gold badges30 silver badges26 bronze badges
ssh-add -A resolved my issue in MacOS Sierra 10.12.6.
I had no problem both for public and private repo before.
Today I tried to clone or git pull for private repo, but it hit the above issues.
After search around, this is the perfect solution for me.
answered Aug 22, 2017 at 8:31
1
On Windows open file:
C:Users<USER_NAME>.sshconfig
You should have your host defined in the «config» file:
host gitlab.com
HostName gitlab.com
IdentityFile ~/.ssh/id_rsa_user_private_key
host bitbucket.org
HostName bitbucket.org
IdentityFile ~/.ssh/id_rsa_user_private_key
host github.com
HostName github.com
IdentityFile ~/.ssh/id_rsa_user_private_key
answered Feb 5, 2019 at 13:33
BrljaBrlja
3643 silver badges14 bronze badges
2
Try these 3 Simple Steps:
It’s pretty straight forward. See the 3 step summary of the links below.
- Check for the existence of SSH keys. If one exists, then great: you can use it. If not, then you will have to create one.
- You will need to add the ssh key to the ssh-agent. If the agent is snoozing on the job, then you will need to wake the agent by writing this to your console/terminal:
eval $(ssh-agent -s). Then you can simply add the key, - Try pushing your repository. Hopefully it should work.
answered Sep 4, 2019 at 5:32
BenKoshyBenKoshy
32k14 gold badges103 silver badges78 bronze badges
I had same issue on my private Ubuntu server using ssh.
My workaround solution was:
open shell on my private server
git init --bare /path/<myapp>.git
and then, from my developer laptop
git push <remote_repo> <local branch>
has finally worked well.
PS:
I’ve never tried, but remote repo with https seems working better than ssh.
I hope this help.
answered Jan 26, 2017 at 8:01
rfellonsrfellons
65812 silver badges27 bronze badges
1
In addition to setting the identity files in the ssh config, I also had to set the git remote to the right user — complete solution in https://www.keybits.net/post/automatically-use-correct-ssh-key-for-remote-git-repo/
vi ~/.ssh/config
Host github.com-myuser
HostName github.com
User git
IdentityFile ~/.ssh/mykey
I made sure I had this identity file loaded with ssh-add -l
ssh-add -l
4096 SHA256:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX mykey (RSA)
Then I set my remote to include the right user
git remote set-url origin git@github.com-myuser:myuser/myrepo.git
Then the push worked
git push -u origin master
Enumerating objects: 146, done.
Counting objects: 100% (146/146), done.
Delta compression using up to 4 threads
Compressing objects: 100% (144/144), done.
Writing objects: 100% (146/146), 9.71 MiB | 7.48 MiB/s, done.
Total 146 (delta 10), reused 0 (delta 0)
remote: Resolving deltas: 100% (10/10), done.
To git@github.com-myuser:myuser/myrepo.git
* [new branch] master -> master
Voila
answered Jun 22, 2019 at 14:28
saranicolesaranicole
1,9231 gold badge21 silver badges23 bronze badges
1
answered Jan 6, 2017 at 16:11
Installing a root/CA Certificate
Given a CA certificate file foo.crt, follow these steps to install it on Ubuntu:
Create a directory for extra CA certificates in /usr/share/ca-certificates:
sudo mkdir /usr/share/ca-certificates/extra
Copy the CA .crt file to this directory:
sudo cp foo.crt /usr/share/ca-certificates/extra/foo.crt
Let Ubuntu add the .crt file’s path relative to /usr/share/ca-certificates to /etc/ca-certificates.conf:
sudo dpkg-reconfigure ca-certificates
This is an old post, but this is they only thing that I found that worked.
answered Feb 17, 2017 at 3:32
SolSol
9191 gold badge9 silver badges23 bronze badges
I also had the exact same error and for some reason restarting my pc solved the error. Maybe it works for somone else too 
answered Apr 19, 2017 at 11:59
If it’s a public repo, just clone using https. No need to use passwords or setup SSH keys.
answered May 18, 2018 at 11:43
CGFoXCGFoX
5,0107 gold badges44 silver badges79 bronze badges
if you want to push/pull any repository from local to remote(git hub)
first checkout
$ git push https://<git-hub url>
working fine with username and passwd credential
$ git push git@<git-hub url>
fail
Could not read remote repository. Please make sure you have the correct access rights and the repository exists.
this means you need to add id_rsa.pub to authorized_keys
goto
$ cd /home/admin/.ssh
$ls
$vi authorized_keys
add id_rsa keys(n no of keys you can add)
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEA0KJDLOiiXj9XdMxiCT9KvaKfuxFQi+CIiklaN5hHsNgYOu7TijqyONEu5fONLoAo/cshLa+KuargyTrtizwcP4TPcTXZhhJrM0GUDJragw7SMVIs/5xJBGAyHKJ1YUMGO7+nJTmsCLx6PFOlQYveuriiVVCCZerGCLH+UtSXK3z+l7hx9NiDg3/ylOLc3f3SLxrJKn0gMTgK7BHJFXo4PguuPjWZLVdUDX+XKiqtT2n4IsYs6N9qVFG3zUgNlEjZM47NK/ytAC0max98pK+QNzsuaQOo/IShJ1TOw5wwScflPArVJ2AyROqAe7cfQg7q12I9olASFd3U5NazfZCTYAvWA1kz9UZEWLJ1Br1XOkPqOleMM8KCp/PXzz8H0kISkMIji0/QuiZOPEBsKlszXjlALcXR8Mg1uiZVWy48i9JheyXyj1ToCj6cPScpgFHp3DAGSlKKbE1EFaVfeeyGAnHESlnDDg3Gq5xSsB9Okqm3V5t8GpFaJbV68BxQ4BK6HJ21A3CinV4LdV3hR/OBUbDG2EcI+ZKRDjlpJuu4YU= stace@pretend-machine
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAywWhrwq4FjHt+UuwZcZePxtjtZOENFpOjufycaYso2nTlzNwnAQEQRfbqsUxKVtOtGxgApIkUvjRIjNBdJE6iOzvBXZhhJrM0GUDJragw7SMVIs/5xJBGAyHKJ1YUMGO7+nJTmsCLx6PFOlQYveuriiVVCCZerGCLH+UtSXK3z+l7hx9NiDg3/ylOLc3f3SLxrJKn0gMTgK7BHJFXo4PguuPjWZLVdUDX+XKiqtT2n4IsYs6N9qVFG3zUgNlEjZM47NK/ytAC0max98pK+QNzsuaQOo/IShJ1TOw5wwScflPArVJ2AyROqAe7cfQg7q12I9olASFd3U5NazfZCTYAvWA1kz9UZEWLJ1Br1XOkPqOleMM8KCp/PXzz8H0kISkMIji0/QuiZOPEBsKlszXjlALcXR8Mg1uiZVWy48i9JheyXyj1ToCj6cPScpgFHp3DAGSlKKbE1EFaVfeeyGAnHESuXC9wkSeFZCEyMJ+RgJxMkBXNZmyycbwsSqAeGJpMEUDlwzu2GD0obBz0HXqg9J1Xallop5AVDKfeszZcc= stace@another-machine
:wq!
goto github-->settings--->ssh---->add new key---->id_rsa.pub
$git push git@<git-hub url>
L_J
2,29510 gold badges24 silver badges28 bronze badges
answered Aug 25, 2018 at 7:24
If you’re using SSH, make sure you’re using a network that allows SSH. Most public networks allow only HTTP(S) traffic.
answered Oct 15, 2018 at 15:03
0
Hi my problem was that my client did not ask if I recognized the key. Opening a terminal and doing ssh -T git@github.com worked. The response in the terminal asked if I wanted to add the key, I said yes and after that, my client worked fine
answered Jan 28, 2019 at 0:34
franksandsfranksands
1,69818 silver badges21 bronze badges
I had a similar issue, Until I realized, I was running my machine through a proxy address for my internet connection and it happens to close the host connection. This could be one of the few reasons too.
answered Feb 1, 2019 at 6:36
anshulanshul
5186 silver badges23 bronze badges
For me, I had followed all the steps mentioned in Adding new ssh key and rest of the auxiliary links related to this issue.
But the issue was network access. Solution — using VPN to access my Github Enterprise. (in my case Georgia Tech VPN for github.gatech.edu)
answered Apr 5, 2019 at 23:47
Chaitanya BapatChaitanya Bapat
3,0135 gold badges31 silver badges57 bronze badges
In my case, I generated new key pairs but forgot to update public key in github.com (settings).
answered Mar 15, 2020 at 3:09
viggy28viggy28
7109 silver badges21 bronze badges
A simple solution to this is delete the old ssh key from github/gitlab and add the same key again. This is easy work around and you have to hussle with anything
answered Sep 30, 2020 at 14:26
dumb_coderdumb_coder
3093 silver badges18 bronze badges
Before you can read from a private repository or write to a Git repository, you must be authenticated. If you use the wrong Uniform Resource Locator (URL) to connect to a repository, or have incorrectly set up your Secure Shell (SSH) authentication, you’ll encounter the “fatal: Could not read from remote repository” error.
This guide discusses what this error means and why you may see it. It walks you through two potential solutions so you can overcome this problem when using Git.

Find Your Bootcamp Match
- Career Karma matches you with top tech bootcamps
- Access exclusive scholarships and prep courses
Select your interest
First name
Last name
Phone number
By continuing you agree to our Terms of Service and Privacy Policy, and you consent to receive offers and opportunities from Career Karma by telephone, text message, and email.
fatal: Could not read from remote repository
SSH is a protocol for authenticating with remote devices. SSH is commonly used to authenticate with Git because you don’t need to type in your password every time you authenticate.
Every platform has its own way of authenticating users over SSH. Using GitHub, for instance, you must provide your SSH key on their dashboard. Then, you can use the SSH URL associated with your repository to authenticate with GitHub.
By default, the private SSH key for your device will be in a file called ~/.ssh/id_rsa. This file is in the hidden .ssh directory in your root folder. This key will only exist if you have generated it. Otherwise, you’ll need to use the ssh-keygen command to generate a new key.
If you have not correctly set up SSH authentication, Git will be unable to verify your identity.
The two common causes to the “fatal: Could not read from remote repository” error are:
- Not adding your SSH key to the SSH agent
- Using a HTTP URL to connect to a repository
Let’s discuss each of these causes.
Cause #1: SSH Agent Issue
The SSH agent stores your SSH key. When you try to authenticate with a Git repository over SSH, Git will check the SSH agent for your key.
Your SSH key can be removed from the SSH agent for various reasons. This will make it impossible to authenticate with a Git repository.
Let’s try to clone a Git repository that is private to our local machine:
git clone git@github.com:career-karma-tutorials/ck-git
When we try to sign in, the Git command line returns an error:
fatal: Could not read from remote repository.
This error informs us we have an authentication issue. If you encounter an SSH authentication issue, your first port of call is to add your key to the SSH keychain:
This will add our id_rsa key to the keychain.
Another common mistake is to add the wrong key to your keychain. If you use a key with a different name than id_rsa to authenticate with Git, make sure you add that key to your keychain and not the id_rsa key.
Cause #2: Using a HTTP URL
There are two ways you can authenticate with Git: over HTTP and SSH. The Hypertext Transfer Protocol (HTTP) method requires specifying your username and password to a Git server to access a repository.
To authenticate with HTTP, you’ll use a URL that looks like this:
https://github.com/career-karma-tutorials/ck-git
You cannot use this URL to connect to a Git server over SSH. This is because SSH and HTTP are different protocols. If you try to sign in to the above URL using SSH, you’ll be prompted to enter your username and password.
We’ve got to use an SSH URL to connect to a repository over SSH. You can verify the URLs that you use to connect to a remote repository using the git remote -v command:
origin https://github.com/career-karma-tutorials/ck-git (fetch) origin https://github.com/career-karma-tutorials/ck-git (push)
We can see that our “origin” remote uses HTTP instead of SSH. For an existing repository, we can change our URL to use SSH using the git remote set-url command:
git remote set-url origin git@github.com:career-karma-tutorials/ck-git
This command sets the “origin” URL to be equal to our SSH URL. Now that we’ve run this command, our existing Git repository will use the SSH URL to connect to the remote version of the repository.
If you are cloning a new repository, you don’t need to change the URL with which you are working. Instead, you just need to make sure you use an SSH URL to clone the repo:
git clone git@github.com:career-karma-tutorials/ck-git
Now, we can run commands like git pull, git commit, and git push on our repository because we have the correct access privileges.
Conclusion
The Git “fatal: Could not read from remote repository” error occurs when there is an issue authenticating with a Git repository. This is common if you have incorrectly set up SSH authentication.
To solve this error, make sure your SSH key is in your keychain and you connecting to a repository using the correct URL.
GitHub is a code hosting platform for version control and collaboration allowing you to work together with other developers from all over the world building software. Let’s say you are starting on this journey and have a personal repository you are trying to perform a git clone or a git push but end up receiving obscure permission denied publickey error. Worry no more, this article will share how to fix this error once and for all.
The Error Message
For instance, when you are running a git clone command, you are seeing an error messaging that goes something like below.
Cloning into '<YOUR FOLDER>'... git@github.com: Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
If you are cloning a git repository using Visual Studio, you might be seeing this error message below which is very obscure and at least to me, not very helpful.
Git failed with a fatal error. Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
If you are seeing any of the above error messages or other messages that relate to could not read from a remote repository, or permission denied (publickey) then read along to learn how to fix this.
Fixing Git Permission Denied PublicKey
After trying many different possible solutions such as re-installing Github desktop, deleting the Visual Studio git folder, and many other solutions that worked for others online, but not for me, the following is the only solution that fixed this issue for me.
Install Open SSH Client
The first step to solve this issue is to generate an SSH key pair that will be later loaded to your GitHub account. On windows, this is very easy to do with the Open-SSH client. To install it head on to your windows settings optional features.

Then install the OpenSSH Client that you see below.

Generate SSH Key Pair
With the OpenSSH Client install you can now use it to generate an SSH Key Pair. Open command prompt as an administrator and type the following:
ssh-keygen
To keep it very simple, just hit ENTER for all that you are prompted. When finished, you should see something like below. I have obscured a few of the items below.

You should also notice in the message where the keys got generated. This location will be used in the following step.
Copy SSH Key To GitHub
To get the key, you need to navigate to the folder where the keys got generated within the command prompt. Once there, type the following command, assuming id_rsa.pub is the filename and that you are using windows, for Linux it will be the cat command instead.
type id_rsa.pub

Now head on to your GitHub account into the settings.


Click where you see New SSH Key and copy the whole string that starts with ssh-rsa into here with an adequate name. Once you do this, git clone or git push will begin to work as expected!
Conclusion
I hope this article has helped you fix this permission denied publickey error and that you are finally able to clone a git repository or begin pushing code changes to one of them.

