Could not read from remote repository

2019-02-04 04:33发布

问题:

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.

回答1:

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.



回答2:

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.



回答3:

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!



回答4:

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



回答5:

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.



回答6:

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.



回答7:

If you have updated you OSX recently you have to call ssh-add -A. Have a look at this answer: https://apple.stackexchange.com/questions/254468/macos-sierra-doesn-t-seem-to-remember-ssh-keys-between-reboots



回答8:

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.



回答9:

I also had the exact same error and for some reason restarting my pc solved the error. Maybe it works for somone else too :P



回答10:

If it's a public repo, just clone using https. No need to use passwords or setup SSH keys.



回答11:

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>


回答12:

I had the same issue with Pycharm on Ubuntu the solution is to use https instead of SSH for example : https://github.com/Bedo1212/myrepo.git



回答13:

If you're using SSH, make sure you're using a network that allows SSH. Most public networks allow only HTTP(S) traffic.



回答14:

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



回答15:

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.



标签: github aptana