How to fix fatal: origin does not appear to be a git repository

The fatal: ‘origin’ does not appear to be a git repository error occurs when you try to commit to a newly made git repository created using the git init command. This happens because git init does not link a local repository to a remote repository. You can check this by running:

git remote -v

If there is no remote repo called origin, you should try the following solution.

Solution

To fix the error, follow the steps below:

  • Inform Git of the location of the remote repository by running the following command:

    git remote add origin <remote_URL>
    

    where remote_URL is the link to the repository where you want your code to be stored.

  • Push your code by running the following command:

    git push origin master
    
New on Educative
Learn to Code
Learn any Language as a beginner
Develop a human edge in an AI powered world and learn to code with AI from our beginner friendly catalog
🏆 Leaderboard
Daily Coding Challenge
Solve a new coding challenge every day and climb the leaderboard

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved