Git push: fatal: 'origin' does not appear to be a git repository - fatal Could not read from remote repository.

28.4K    Asked by ElizabethJordan in Devops , Asked on Apr 20, 2021

 Everything was working smoothly, as I could:

git add . all the files from my local repository.

git commit -m "message here" to add messages to my commits.

git push origin master to upload my files to GitHub.

git push heroku master to upload my files to Heroku.

However, at some point, I created a new branch locally called add-calendar-model in case the next steps of the app development,

which is exactly what happened.

However, despite many attempts, I did not manage to get the initial code — i.e. the code from before I created the new branch — from the master branch to my local repository.

So, I decided to manually delete all the files from my local repository and git clone my master branch from GitHub.

This way, I got all my files back, but now, I cannot push anymore to the remote repository.

Any time I try to run git push origin add-calendar-model or git push origin master, I get the following error:

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.

I am not very comfortable with Git and GitHub, as you may have guessed by now, and I have to admit that I have no clue about how to fix this error.

Any idea?

Answered by Elizabeth Jordan

This error “fatal origin does not appear to be a git repository” occurs due to the remote is not added so what you could do is:

git remote -v
git remote remove
Then add
git remote add
Then you could do:
git push origin master
 So that this will work. Hope this will help you.

Note: The “fatal: 'origin' does not appear to be a git repository” error occurs when you try to push code to a remote Git repository without telling Git the exact location of the remote repository. To solve this error, use the git remote add command to add a remote to your project.


Your Answer

Interviews

Parent Categories