Cyberithub

Solved "git push fatal: 'origin' does not appear to be a git repository"

Advertisements

In this article, we will see how to solve fatal: 'origin' does not appear to be a git repository error which might come during git push operation. Along with this you may also see fatal: Could not read from remote repository error with message Please make sure you have the correct access rights and the repository exists on the output. Let me tell you, this error usually occurs when git can't find the remote repository named "origin". Now this can happen due to few reasons, we will try to go through all those reasons and understand how to fix it.

 

Solved "git push fatal: 'origin' does not appear to be a git repository"

Solved "git push fatal: 'origin' does not appear to be a git repository"

Also Read: Solved "CONFLICT (modify/delete): 'file' deleted in HEAD and modified" error

First of all you are not the only one getting this fatal: 'origin' does not appear to be a git repository error. Lot of other folks working on git version control often get this error. Even I have faced the same issue once and then fixed it by understanding the reason for same. Probably I will use my scenario to explain you about the problem and how to fix in case you are also facing the same. So in my case, when I was trying to push my local updates to remote feature/addPlugin branch in a repo, I faced below error:-

cyberithub@macos1066 % git push -u origin feature/addPlugin
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.

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

After noticing above error, first I checked remote repository URL using git remote -v command as shown below.

cyberithub@macos1066 % git remote -v

After running above command, I did not got any output. This means no remote repositories are currently configured for your local Git repository. So to fix this issue, you have to configure remote repo. Since my repo url was https://github.com/cyberithub/atlantis-example.git, I had to use git remote add origin https://github.com/cyberithub/atlantis-example.git command to configure remote repo for my local git repo.

cyberithub@macos1066 % git remote add origin https://github.com/cyberithub/atlantis-example.git

Once added, I ran again git remote -v command to check repo url. Guess what? This time I noticed url is successfully added as you can also see below.

cyberithub@macos1066 % git remote -v
origin https://github.com/cyberithub/atlantis-example.git (fetch)
origin https://github.com/cyberithub/atlantis-example.git (push)

This fixed my issue and then I was able to push my updates to remote branch using git push command. Now this is one of the reason for fatal: 'origin' does not appear to be a git repository error. There could be other reasons as well for this error. Let's understand those.

 

Case 1: Remote repo does not exist

It is possible that sometimes repo was unknowingly deleted and you won't know that immediately and keep on trying to push your updates without checking if it exists or not. So in those cases as well you get the same error. It is always important to first verify the existence of repo and hence the repo url to get rid of this kind of issue.

 

Case 2: Incorrect repo url given

In some cases, it is also possible that you might be using incorrect url of remote repo. To verify the correctness of url, go to remote repo and check url there. If it is correct then check if you are using any extra characters or spaces that might be causing the issue. Sometimes copying url from repo and pasting it in your local system might show you same error even though url is correct. This is simply because of formatting error in your system which would be difficult to identify. In that case, you might need to type it manually to fix the problem.

 

Hope above solution would be enough to solve your error as well. Please let me know your feedback in comment box.

Leave a Comment