How to Fix ‘Fatal: Origin does not appear to be a Git Repository’ Error
Git is a distributed version control system which is primarily used to track changes in source code during software development. GitHub is an online hosting service for version control using Git. Both these services are used extensively in Software Development. However, quite recently, a lot of reports have been coming in where users are unable to execute “git” commands in their Mac Terminal.
In this article, we will talk about the reasons due to which the error is triggered and provide you with viable solutions to fix the issue. Make sure to follow the guide carefully in order to avoid conflicts.
What Causes the “Fatal: ‘origin’ does not appear to be a Git Repository” Error?
After receiving numerous reports from multiple users we decided to investigate the issue and started identifying its root cause. According to our reports, the reasons due to which this error is triggered is listed below:
- Missing Origin: This error is usually seen when the “Origin” is missing. Origin is the reference to “Github-Fork” and if missing, some commands don’t work properly.
- Incorrect URL: In some cases, the URL configuration set by the application might be false and it might have to be changed. Due to which, some commands might not be working properly.
Now that you have a basic understanding of the nature of the problem, we will move on towards the solutions.
Solution 1: Adding Origin
If Origin (that references to Fork) is missing certain commands might not work properly. Therefore, in this step, we will be adding an Origin manually. In order to do that:
- Press the “Command” + “Space” buttons simultaneously.
- Type in “Terminal” and press “Enter“.
- Type in the following command and press “Enter”
git remote -v
- Check to see if there is a remote named “Origin” listed.
- If not, it means that your “Origin” is missing.
- Add Origin using the following command
git remote add origin url/to/your/fork
- Check to see if the issue persists.
Solution 2: Changing URL
If the URL is not referenced correctly it might prevent certain functions of the application from working properly. Therefore, in this step, we will be changing the URL. For that:
- Press the “Command” + “Space” buttons simultaneously.
- Type in “Terminal” and press “Enter“.
- Use the command below to change the URL
git remote set-url origin ssh://git@github.com/username/newRepoName.git
- Check to see if the issue persists.
Solution 3: Changing Origin to Master
If you are trying to pull from Master, it is necessary to change the origin to master before trying to add or remove the remote. Therefore, in this step, we will be changing the Origin to Master. For that:
- Press the “Command” + “Space” buttons simultaneously.
- Type in “Terminal” and press “Enter“.
- Use the command below to change the Origin to master
git pull origin master