Skip to content

How to Fix Git Remote Origin Not Found Error

DodaTech Updated 2026-06-24 2 min read

In this tutorial, you'll learn about How to Fix Git Remote Origin Not Found Error. We cover key concepts, practical examples, and best practices.

You run git push or git pull and get fatal: 'origin' does not appear to be a git repository — the remote named origin is not configured in your local repository.

The Problem

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.

Step-by-Step Fix

Step 1: Check existing remotes

git remote -v

If nothing shows, no remotes are configured.

Step 2: Add the origin remote

git remote add origin https://github.com/user/repo.git

Or with SSH:

git remote add origin git@github.com:user/repo.git

Step 3: Verify the remote

git remote -v

Expected:

origin   https://github.com/user/repo.git (fetch)
origin   https://github.com/user/repo.git (push)

Step 4: Update the remote URL if it changed

git remote set-url origin https://github.com/newuser/newrepo.git

Step 5: Test the connection

git remote show origin

Expected:

* remote origin
  Fetch URL: https://github.com/user/repo.git
  Push  URL: https://github.com/user/repo.git
  HEAD branch: main
  Remote branches:
    main tracked
  Local branch configured for 'git pull':
    main merges with remote main
  Local ref configured for 'git push':
    main pushes to main (up to date)

Step 6: Set upstream tracking

git push -u origin main

Step 7: Remove a wrong remote

git remote remove origin
git remote add origin <correct-url>

Prevention Tips

  • Always clone with git clone <url> to get the remote automatically
  • Verify remote URLs with git remote -v after cloning
  • Use SSH URLs for private repositories
  • Document the remote URL in your project README
  • Use git remote rename instead of remove/add to avoid mistakes

Common Mistakes with remote not found

  1. Placing the wildcard pattern first in case expressions, making all subsequent patterns unreachable
  2. Using head and tail instead of pattern matching, causing runtime errors on empty lists
  3. Forgetting that lazy evaluation defers computation until the value is forced, causing space leaks with unevaluated thunks

These mistakes appear frequently in real-world GIT code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

### What if I have the wrong remote URL?

Update it with git remote set-url origin <new-url>. Check the current URL with git remote get-url origin. Common mistakes: HTTP vs SSH mismatch, typos in username/repo name, expired access tokens.

What is the difference between origin and upstream?

origin is your fork or the primary remote. upstream is conventionally the original repository you forked from. Add it with git remote add upstream <url> to sync with the original repo.

Can I have multiple remotes?

Yes. Add remotes with different names: git remote add backup git@gitlab.com:user/repo.git. Push to multiple remotes with git remote set-url --add --push origin <url>.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro