Error repository not found fatal could not read from remote repository

I am getting this error - D:ProjectswampwwwREPO [master]> git pull origin master Warning: Permanently added 'github.com,192.30.252.128' (RSA) to the list of known hosts. ERROR: Repository ...

I am getting this error —

D:ProjectswampwwwREPO [master]> git pull origin master
Warning: Permanently added 'github.com,192.30.252.128' (RSA) to the list of known hosts.
ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

The output of git remote -v

D:ProjectswampwwwREPO [master]> git remote -v
origin  git@github.com:username/repo.git (fetch)
origin  git@github.com:username/repo.git (push)

Final message of ssh -Tv git@github.com command —

Hi [My Username]! You've successfully authenticated, but GitHub does not provide shell access.

How can I solve it?

asked May 6, 2015 at 5:33

Napster's user avatar

NapsterNapster

2,8645 gold badges32 silver badges54 bronze badges

11

change your ssh url by an http url for your remote ‘origin’, use:

> git remote set-url origin https://github.com/<user_name>/<repo_name>.git

It will ask for your GitHub password on the git push.

answered Oct 14, 2016 at 17:41

Siyaram Malav's user avatar

Siyaram MalavSiyaram Malav

4,1522 gold badges31 silver badges30 bronze badges

8

I asked in the discussion:

does ssh -T git@github.com ouput the same username (in Hi [My Username]!) as in the one used for the ssh url of your repo (git@github.com:username/repo.git)?

Sorry It not showing same name

That means somehow the credentials have changed.

One solution would be to at least copy %HOME%.sshid_rsa.pub in the SSH keys section of the right GitHub account

The OP adds:

I am working on private repo. So In git@github.com:username/repo.git,

I replied:

If you were able to clone/push to that repo whose username is not your own GitHub account, that must be because you had your previous public ssh key added as a contributor to that repo by the repo’s owner.

What next is to ask that same repo owner to add your current public ssh key %HOME%.sshid_rsa.pub to the repo contributor list.
So check with the owner that you (meaning your public ssh key) are declared as a contributor.

Community's user avatar

answered May 6, 2015 at 6:37

VonC's user avatar

VonCVonC

1.2m508 gold badges4248 silver badges5069 bronze badges

For me, I was getting this error because my ssh agent was not running somehow.
Doing this worked:

eval `ssh-agent -s`
ssh-add path_to_your_key

answered Nov 16, 2021 at 15:56

Shashank Ks's user avatar

Shashank KsShashank Ks

3303 silver badges8 bronze badges

1

This error happened to me too as the original repository creator had left the company, which meant their account was deleted from the github team.

git remote set-url origin https://github.com/<user_name>/<repo_name>.git

And then
git pull origin develop or whatever git command you wanted to execute should prompt you for a login and continue as normal.

answered Apr 21, 2017 at 12:37

Muhan Alim's user avatar

Muhan AlimMuhan Alim

4591 gold badge7 silver badges17 bronze badges

1

This error can be because of no SSH key on the your local machine. Check the SSH key locally:

$ cat ~/.ssh/id_rsa.pub

If above command do not give any output use below command to create ssh key(Linux/Mac):

$ ssh-keygen 

Now again run cat ~/.ssh/id_rsa.pub This is your SSH key. Copy and add this key to your SSH keys in on git.
In gitlab/bitbucket go to

profile settings -> SSH Keys -> add Key

and add the key

answered Nov 13, 2017 at 4:09

BSB's user avatar

BSBBSB

2,13015 silver badges25 bronze badges

ssh-add -D  # Delete all identities.
ssh-add ~/.ssh/your_key

Edit 1
Since I get so many votes, I discovered some issue with this approach and that is that it will remove all your identities so you might have the same issue when you try to read from other repositories and you will need to to this step again for each project…but it might also not be the case for your project

answered Jul 16, 2020 at 10:56

Tudor's user avatar

TudorTudor

1,4421 gold badge18 silver badges17 bronze badges

Sometimes this happens to me because of network problems. I don’t understand the problem fully, but switching to a different sub-network or using VPN solves it

answered Jun 22, 2015 at 15:06

kip2's user avatar

kip2kip2

6,1453 gold badges52 silver badges69 bronze badges

1

I got the very same errors too. In My case upgrading from Windows 7 to 8 messed up my settings. What helped was to regenerate the private and public SSH keys using PuTTYGen, and change the SSH tool in tortoisegit from SSH to Plink.

I have shared the step by step steps also at http://techblog.saurabhkumar.com/2015/09/using-tortoisegit-on-windows-with.html

answered Sep 11, 2015 at 2:59

Saurabh Kumar's user avatar

Saurabh KumarSaurabh Kumar

2,3096 gold badges32 silver badges52 bronze badges

0

Maybe, as in my silly situation, you may somehow created the ssh key by directly typing

ssh-keygen

And so it is created with the local system user credentials so they don’t match, use full command like this and recreate

ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

answered Mar 10, 2020 at 0:47

Erdinç Çorbacı's user avatar

Try:

git config --global credential.helper cache

This command prevents git to ask username and password, not forever but with a default limit to 15 minutes.

git config --global credential.helper 'cache --timeout=3600'

This moves the default limit to 1 hour.

answered Apr 10, 2020 at 12:29

Krishna Bagale's user avatar

For me none of the solutions here solved it. Frustrated, I restarted my Macbook’s iTerm terminal, and voila! My github authorization started working again.

Weird, but maybe iTerm has its own way of handling SSH authorizations or that my terminal session wasn’t authorized somehow.

answered Sep 29, 2020 at 9:58

Jonathan Perry's user avatar

Jonathan PerryJonathan Perry

2,8632 gold badges44 silver badges49 bronze badges

Easy solution for me:

1.) The public SSH Key has to be saved on https://github.com/settings/keys

2.) The email address inside «~/.ssh/id_rsa.pub» (At the end of the file) has to be entered on Github (https://github.com/settings/emails). (This was my problem)

After I saved the email address on GitHub, the problem solved itself. 🚀

answered Oct 10, 2022 at 21:49

emovere's user avatar

emovereemovere

1521 silver badge12 bronze badges

I had this issue and tried many things but still din’t work. Eventually I decided to generate another SSH KEY and boom — it worked. Follow this article by github to guide you on how to generate your SSH KEY.

Lastly don’t forget to add it to your github settings. Click here for a guide on how to add your SSH KEY to your github account.

answered Jun 20, 2017 at 13:00

otoloye's user avatar

otoloyeotoloye

6276 silver badges11 bronze badges

In my case updating GIT helps — I had version 2.23 and with installing version 2.26.2.windows.1 problem disapears.

So if you are sure your SSH key is valid then (see @VonC answer):

  1. update GIT
  2. update composer
  3. run composer clearcache

And it should be ok.

answered Apr 26, 2020 at 13:30

Manic Depression's user avatar

Manic DepressionManic Depression

9702 gold badges16 silver badges33 bronze badges

This issue could be related with missing SSH key at Github or any other git server.

In my case I had copied code to another computer and tried to git pull. It failed.

So I had to generate a new SSH key on that machine and update profile on git server with additional SSH key.

answered Jun 18, 2020 at 19:07

laimison's user avatar

laimisonlaimison

1,2732 gold badges15 silver badges37 bronze badges

Strangely I had this occur with a single repository out of > 20 repositories on my MacBook Pro.

The solution was to upgrade git via homebrew, and everything strangely worked after it finished:

brew install git

Hope this helps someone!

answered Jul 8, 2020 at 1:42

Steve Bauman's user avatar

Steve BaumanSteve Bauman

7,7357 gold badges39 silver badges55 bronze badges

Its not necessary to apply above solutions, I simply changed my internet, it was working fine with my home internet but after 3 to 4 hours my friend suggest me to connect with different internet then I did data package and connect my laptop with it, now it is working fine.

answered Dec 2, 2020 at 14:18

nafees ahmed's user avatar

nafees ahmednafees ahmed

9181 gold badge10 silver badges18 bronze badges

I had the same problem. I tried a couple of solutions mentioned above, it did not work for me. I even restarted my machine and also reconnected my WLAN. But all in vain. Then on the remote repo, I manually made a small change in the readme file of the repo. To pull that change on the local copy of my repo in my machine, I did the usual git pull and then the git push origin. This actually worked.

answered Oct 19, 2021 at 20:21

BZKN's user avatar

BZKNBZKN

1,4292 gold badges9 silver badges25 bronze badges

For me somehow sudo rebooting the fluffing EC2 instance after a fresh ssh-keygen and rm ~/.ssh/known_hosts fixed it! Still not sure how it works but it worked on 4 different EC2 servers with uptime over 700 days. I think it is related to some breaking updates on some processes during the 700 days!! Still not sure what fixed it but for damn its fixed!

answered Dec 5, 2022 at 18:10

Nidhin David's user avatar

Nidhin DavidNidhin David

2,4063 gold badges32 silver badges44 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.

Get offers and scholarships from top coding schools illustration

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

Email

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.

Fix Git’s repository not found error

There’s nothing worse than joining a new development team and eagerly cloning the existing source code repo only to run head first into Git’s ‘fatal: repository not found’ error. For those who struggle with that problem, here are five potential fixes to the frustrating repository not found error message.

1. You did not authenticate

If you attempt to connect to a private GitHub or BitBucket repository and fail to authenticate, you will receive the repository not found error. To ensure you are indeed authenticating, connect to the repository and include your username and password in the Git URL:

git clone https://mcnz:[email protected]/cameronmcnz/private-github-repo.git


2. Your password has changed

Have you changed your password lately? If you connect from a Microsoft-based workstation, the Windows Credentials Manager may transparently submit an old password every time you clone, pull or fetch. Make sure your computer doesn’t cache any old, out of date passwords and cause your connection to be rejected.

3. You are not a collaborator

You may authenticate successfully against GitHub or GitLab, but if you haven’t been made a collaborator on the project, you won’t be able to see the repository and will again trigger the fatal: repository not found exception. If you’re not a collaborator on the project, contact one of the GitHub or BitBucket repository administrators and have them add you to that role.

4. Incorrect case or a word misspelled

If your source code management tool is hosted on a Linux distribution, the repository name may be case sensitive. Also watch out for creative repository spellings, such as a zero instead of the letter O, or a one in place of the letter L. If you can copy and paste the git clone command from provided documentation, do that.

5. The git repository has been deleted

If the repository was deleted or renamed, you’ll obviously hit a Git repository not found error when you attempt to clone or fetch from it. If all else fails, check with the team lead to ensure that the remote repository does indeed still exist. One way to fix that problem is to log into your DVCS tool as an administrator and actually create the Git repository.

If you have any more insights on why developers might run into Git’s ‘fatal: repository not found‘ error, please add your thoughts to the comments.

HTTPS cloning errors

There are a few common errors when using HTTPS with Git. These errors usually indicate you have an old version of Git, or you don’t have access to the repository.

Here’s an example of an HTTPS error you might receive:

> error: The requested URL returned error: 401 while accessing
> https://github.com/USER/REPO.git/info/refs?service=git-receive-pack
> fatal: HTTP request failed
> Error: The requested URL returned error: 403 while accessing
> https://github.com/USER/REPO.git/info/refs
> fatal: HTTP request failed
> Error: https://github.com/USER/REPO.git/info/refs not found: did you run git
> update-server-info on the server?

Check your Git version

There’s no minimum Git version necessary to interact with GitHub, but we’ve found version 1.7.10 to be a comfortable stable version that’s available on many platforms. You can always download the latest version on the Git website.

Ensure the remote is correct

The repository you’re trying to fetch must exist on GitHub.com, and the URL is case-sensitive.

You can find the URL of the local repository by opening the command line and
typing git remote -v:

$ git remote -v
# View existing remotes
> origin  https://github.com/ghost/reactivecocoa.git (fetch)
> origin  https://github.com/ghost/reactivecocoa.git (push)

$ git remote set-url origin https://github.com/ghost/ReactiveCocoa.git
# Change the 'origin' remote's URL

$ git remote -v
# Verify new remote URL
> origin  https://github.com/ghost/ReactiveCocoa.git (fetch)
> origin  https://github.com/ghost/ReactiveCocoa.git (push)

Alternatively, you can change the URL through our
GitHub Desktop application.

Provide an access token

To access GitHub, you must authenticate with a personal access token instead of your password. For more information, see «Creating a personal access token.»

If you are accessing an organization that uses SAML SSO and you are using a personal access token (classic), you must also authorize your personal access token to access the organization before you authenticate. For more information, see «About authentication with SAML single sign-on» and «Authorizing a personal access token for use with SAML single sign-on.»

Check your permissions

When prompted for a username and password, make sure you use an account that has access to the repository.

Tip: If you don’t want to enter your credentials every time you interact with the remote repository, you can turn on credential caching. If you are already using credential caching, please make sure that your computer has the correct credentials cached. Incorrect or out of date credentials will cause authentication to fail.

Use SSH instead

If you’ve previously set up SSH keys, you can use the SSH clone URL instead of HTTPS. For more information, see «About remote repositories.»

Error: Repository not found

If you see this error when cloning a repository, it means that the repository does not exist or you do not have permission to access it. There are a few solutions to this error, depending on the cause.

Check your spelling

Typos happen, and repository names are case-sensitive. If you try to clone git@github.com:user/repo.git, but the repository is really named User/Repo you will receive this error.

To avoid this error, when cloning, always copy and paste the clone URL from the repository’s page. For more information, see «Cloning a repository.»

To update the remote on an existing repository, see «Managing remote repositories».

Checking your permissions

If you are trying to clone a private repository but do not have permission to view the repository, you will receive this error.

Make sure that you have access to the repository in one of these ways:

  • The owner of the repository
  • A collaborator on the repository
  • A member of a team that has access to the repository (if the repository belongs to an organization)

Check your SSH access

In rare circumstances, you may not have the proper SSH access to a repository.

You should ensure that the SSH key you are using is attached to your personal account on GitHub. You can check this by typing
the following into the command line:

$ ssh -T git@github.com
> Hi USERNAME! You've successfully authenticated, but GitHub does not
> provide shell access.

If the repository belongs to an organization and you’re using an SSH key generated by an OAuth App, OAuth App access may have been restricted by an organization owner. For more information, see «About OAuth App access restrictions.»

For more information, see Adding a new SSH key to your GitHub account.

Check that the repository really exists

If all else fails, make sure that the repository really exists on GitHub.com!
If you’re trying to push to a repository that doesn’t exist, you’ll get this error.

Error: Remote HEAD refers to nonexistent ref, unable to checkout

This error occurs if the default branch of a repository has been deleted on GitHub.com.

Detecting this error is simple; Git will warn you when you try to clone the repository:

$ git clone https://github.com/USER/REPO.git
# Clone a repo
> Cloning into 'repo'...
> remote: Counting objects: 66179, done.
> remote: Compressing objects: 100% (15587/15587), done.
> remote: Total 66179 (delta 46985), reused 65596 (delta 46402)
> Receiving objects: 100% (66179/66179), 51.66 MiB | 667 KiB/s, done.
> Resolving deltas: 100% (46985/46985), done.
> warning: remote HEAD refers to nonexistent ref, unable to checkout.

To fix the error, you’ll need to be an administrator of the repository on GitHub.com.
You’ll want to change the default branch of the repository.

After that, you can get a list of all the available branches from the command line:

$ git branch -a
# Lists ALL the branches
>   remotes/origin/awesome
>   remotes/origin/more-work
>   remotes/origin/new-main

Then, you can just switch to your new branch:

$ git checkout new-main
# Create and checkout a tracking branch
> Branch new-main set up to track remote branch new-main from origin.
> Switched to a new branch 'new-main'

Понравилась статья? Поделить с друзьями:
  • Error resolving dependencies dbeaver oracle
  • Error reporting php none
  • Error resolving address
  • Error reporting e error e parse
  • Error resolution 1693x810 is not supported