fatal: origin does not appear to be a git repository

Problem fatal: origin does not appear to be a git repository

This error fatal: origin does not appear to be a git repository appears on your screen when you try to push something into the master branch of the GitHub account. The error seems to appear as follows:

 

 

In this blog, we will learn how we can solve the above problem. The code for the git config file is given below:

 

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
[branch "master"]
[branch "MOODLE_23_STABLE"]
[branch "MOODLE_24_STABLE"]
[remote "upstream"]
    url = git://git.moodle.org/moodle.git
    fetch = +refs/heads/*:refs/remotes/upstream/*

 

 

Solution

The first and foremost thing one should keep in their mind is that git config is the global configuration for the git repository. In a general git file, there are three levels of configurations. 

 

 

cat $(git rev-parse --show-toplevel)/.git/config

 

 

This is the local level of configurations. Another command is to check whether there is any file named origin already within the directory. 

 

 

git remote -v

 

 

If there is no file then one needs to add it to the git repo. The command for the same is:

 

 

git remote add origin url/to/your/fork

 

 

The image below shows the flowchart of the real working of the git push operations. 

 

 

Another reason for the same is that before adding and removing the remote, try to ensure that the other branch you’re attempting to pull from isn’t out of sync (if you are trying to pull from the master). The command for the same is shown below:

 

 

git pull origin master

 

 

Also Read: Combine PDFs via Python

Share this post

Leave a Reply

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