Could not read from remote repository
Asked Answered
R

21

59

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.

Richrichara answered 26/4, 2013 at 21:37 Comment(3)
Have you tried cloning the repository using the command line version of Git? Are you trying to pull using HTTPS or SSH?Beautician
I don't understand the down vote. In any case, I also encounter this error message when attempting to checkout private repositories. Public repositories don't seem to have this problem.Gymnosperm
I am trying pull using SSH and i am getting same errorProducer
S
21

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.

Soriano answered 26/4, 2013 at 21:57 Comment(0)
C
9

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!

Castor answered 25/4, 2016 at 14:26 Comment(1)
I had the same issue this morning and your answer resolved it for me as well. One clue that it was not a problem with my SSH key (or authentication in general): I had a number of repositories from the same account but only one was affected.Hays
T
7

Click this

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.

Trace answered 27/2, 2017 at 18:8 Comment(0)
E
5

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

Eversion answered 1/2, 2017 at 19:12 Comment(0)
U
4

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.

Ultimate answered 22/8, 2017 at 8:31 Comment(1)
Chrs for the Bryan - would you be able to elaborate a little more on what the ssh-add -A does?Gervase
F
4

On Windows open file:
C:\Users\<USER_NAME>\.ssh\config

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
Flyaway answered 5/2, 2019 at 13:33 Comment(2)
I had "host github" on the first line of the github section, rather than "host github.com". Thanks!Cloak
Resolved my issue, thanks! If config is missing, copy id_rsa_X, rename to config, edit in Notepad and paste in the contents above. Use # to comment out sections that are not required.Skelton
G
4

Try these 3 Simple Steps:

It's pretty straight forward. See the 3 step summary of the links below.

  1. 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.
  2. 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,
  3. Try pushing your repository. Hopefully it should work.
Gervase answered 4/9, 2019 at 5:32 Comment(0)
I
1

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.

Icky answered 26/1, 2017 at 8:1 Comment(1)
The --bare was what I was missing. Thx so much.Springbok
A
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 [email protected]: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 [email protected]:myuser/myrepo.git
 * [new branch]      master -> master

Voila

Anthracite answered 22/6, 2019 at 14:28 Comment(1)
thank you ! you saved me.. the one thing I did is add -user after [email protected] in ssh and set remote url again.Posh
F
0

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

Frump answered 6/1, 2017 at 16:11 Comment(0)
C
0

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.

Choreodrama answered 17/2, 2017 at 3:32 Comment(0)
N
0

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

Narcotize answered 19/4, 2017 at 11:59 Comment(0)
P
0

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

Phenix answered 18/5, 2018 at 11:43 Comment(0)
D
0

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 AAAAB3NzaC1yc2EAAAABIwAAAIEA0KJDLOiiXj9XdMxiCT9KvaKfuxF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MEUDlwzu2GD0obBz0HXqg9J1Xallop5AVDKfeszZcc= stace@another-machine

:wq!

goto github-->settings--->ssh---->add new key---->id_rsa.pub

$git push git@<git-hub url>
Degust answered 25/8, 2018 at 7:24 Comment(0)
M
0

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

Manolete answered 4/9, 2018 at 16:52 Comment(0)
Q
0

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

Quirita answered 15/10, 2018 at 15:3 Comment(0)
M
0

Hi my problem was that my client did not ask if I recognized the key. Opening a terminal and doing ssh -T [email protected] worked. The response in the terminal asked if I wanted to add the key, I said yes and after that, my client worked fine

Milt answered 28/1, 2019 at 0:34 Comment(0)
D
0

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.

Diamagnet answered 1/2, 2019 at 6:36 Comment(0)
O
0

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)

Ofay answered 5/4, 2019 at 23:47 Comment(0)
T
0

In my case, I generated new key pairs but forgot to update public key in github.com (settings).

Tiddly answered 15/3, 2020 at 3:9 Comment(0)
B
0

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

Brunildabruning answered 30/9, 2020 at 14:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.