Tips to fix Git fatal: Could not read from remote repository

GitHub is quite popular among programmers as it has given them a platform to share their projects with their team as well as make it public to assist non-programmers. When working on Github, there are several errors that you may experience. Git fatal: Could not read from remote repository is one of those errors that keep you wondering what mistake you made to get the warning. The reason for this error is that so many people are basically copying the command from the internet.

You don’t need to worry as we are going to shed light on how you get the error and what you can do to get it fixed. Let’s start with the error that you may be experiencing

How do you get an error warning

When you are using Github, you can get the following error

D:\Projects\wamp\www\REPO [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.

This is exactly what type of error you get. The reason for this error ‘Git fatal: Could not read from remote repository’ is accessing it using SSH protocol. You end up with the error. This warning occurs when you don’t have permission to use the remote repository.

Now that you have come across the error you get, check out how you fix it

How to Fix ‘Git fatal: Could not read from remote repository’?

You get the error because of two reasons; no SSH key added to the SSH agent and the use of the HHTP URL for repository connect. Have a look at the solutions

Add SSH key

You need to make sure the SSH agent should store the key. The agent will be checked by Git for the key when you are trying to check for authentication with the repository. In some cases, the key is removed from the agent, which can cause the issue.

Take a look at the code to clone the Git repository to the local machine, which is private

git clone [email protected]:career-tutopal-tutorials/ck-git

The moment you sign in, you will get the error in the return of the Git Command.

fatal: Could not read from remote repository.

It shows that there is an authentication issue. To resolve the issue, you need to add the key to the keychain SSH. Add this code

ssh-add ~/.ssh/id_rsa

This can resolve the error you have been experiencing.

With a HTTP URL

Another way to fix the error, you need to authenticate the Git using HTTP. In this process, you need to mention the username and password to the server of Git to have an access to use the repository. In order to authenticate, your URL should be like

https://github.com/career-tutopal-tutorials/ck-git

To verify the URL that you are connecting to, you need to use the git -v command

origin    https://github.com/career- tutopal -tutorials/ck-git (fetch)
origin    https://github.com/career- tutopal -tutorials/ck-git (push)

To setup Git remote url, use the below command

git remote set-url origin [email protected]:career-tutopal-tutorials/ck-git

in the case, you are trying to clone a repository, no need to change the URL you are working with. It is to ensure that the SSR URL to clone the repository should be used.

git clone [email protected]:career-tutopL-tutorials/ck-git

Conclusion

The ‘Git fatal: Could not read from remote repository’ is highlighted in this article with a few effective as well as simpler ways. I hope you find it helpful!

Reference Source: https://www.janbasktraining.com/community/devops/git-push-fatal-origin-does-not-appear-to-be-a-git-repository-fatal-could-not-read-from-remote-repository

https://support.circleci.com/hc/en-us/articles/360009699913-Can-t-read-from-remote-git-repository-during-npm-install

Posted in Git

Leave a Reply

Your email address will not be published. Required fields are marked *