How to Fix “Git ‘origin’ does not appear to be a git repository”
If git push origin main prints fatal: 'origin' does not appear to be a git repository, the repository has no remote named origin. Check the registered remote names with git remote -v, then either register one with git remote add or fix the name with git remote rename. After that, the same command works.
This error appears when you push a newly created repository to GitHub or similar for the first time, or when you mistype the remote name. I reproduced it in five cases, such as having no remote registered and mistyping the name in the command, and fixed each one.
The test environment is Ubuntu 24.04, Git 2.43.0, and bash 5.2. I ran everything with LANG=C so the messages would be in English. For remotes, I used bare repositories created inside the same test environment (such as ../server/app.git). I did not test connecting to services like GitHub, and I did not test on Windows or macOS. Working directory paths in the output are replaced with /path/to/….

Shown when no remote is registered
A repository just created with git init has no remotes. git remote -v printed nothing. Pushing to origin in this state prints the following message, and the exit code is 128.
$ git remote -v
$ git push origin main
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.
git push -u origin main, git fetch origin, and git pull origin main all printed exactly the same text. Only git pull returned exit code 1.
Fix: register origin with git remote add
As the official git remote reference describes, git remote add <name> <URL> registers the repository at that URL as a remote with the given name. After I registered it as origin, the same git push -u origin main succeeded.
$ git remote add origin ../server/app.git
$ git remote -v
origin ../server/app.git (fetch)
origin ../server/app.git (push)
$ git push -u origin main
To ../server/app.git
* [new branch] main -> main
branch 'main' set up to track 'origin/main'.
Here I used a folder inside the test environment (../server/app.git) instead of a URL. In practice, specify the URL of the remote repository you want to push to. The basic usage of git remote is covered in a separate article, "How to add, change the URL of, and delete a git remote."
Why it says "not a repository"
According to the official git push reference, the <repository> argument can be either a URL or a remote name. Looking at Git's source (remote.c), when no remote with the given name is registered, Git treats the name as a URL as is.
So when origin is not registered, Git tries to open a folder named origin as a repository. Since it cannot be opened, it prints 'origin' does not appear to be a git repository.
If a folder with that name really exists, the push goes into it. In the following example, I created a bare repository named orign in the working directory, which is not registered as a remote, and pushed to it. There was no error, the output was To orign, and main was created in that folder.
$ git init -q --bare orign
$ git push orign main
To orign
* [new branch] main -> main
$ git -C orign log --oneline main
e983eb7 最初のコミット
After checking this, I deleted the orign folder. The examples in the next section were run without this folder.
Because of this behavior, the text between ' ' in the message may be a remote name or a URL. Which one it is determines where you need to fix things (covered in the last section of this article).
The mistyped name appears in the message
Even after you register origin, mistyping the name in a command produces the same kind of error. The mistyped name (orign) appears between the ' '.
$ git push orign main
fatal: 'orign' 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.
$ git remote
origin
git remote lists only the names of registered remotes. If origin appears here, the remote setup is correct, so running the command again with the correct name will work. Passing a name to git remote get-url prints error: No such remote 'orign' for a name that is not registered, so you can clearly check whether the name exists.
$ git remote get-url orign
error: No such remote 'orign'
$ git remote get-url origin
../server/app.git
The remote is not named origin
origin is the name that git clone assigns by default. As the official git clone reference explains, if you clone with --origin (-o), the remote gets a different name. In a repository cloned with -o upstream, pushing to origin produced an error.
$ git remote -v
upstream /path/to/server/app.git (fetch)
upstream /path/to/server/app.git (push)
$ git push origin main
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.
There are two ways to fix this. You can keep the name as it is and push using the registered name, such as git push upstream main, which succeeds.
$ git push upstream main
To /path/to/server/app.git
e983eb7..b708781 main -> main
If you want to keep using origin, rename the remote with git remote rename. According to the official reference, renaming also rewrites the remote-tracking branches (such as upstream/main) and the remote's settings to use the new name. In practice, the upstream of main also changed to origin/main, and git push origin main succeeded.
$ git remote rename upstream origin
$ git remote -v
origin /path/to/server/app.git (fetch)
origin /path/to/server/app.git (push)
$ git branch -vv
* main b708781 [origin/main] 2つめのコミット
$ git push origin main
To /path/to/server/app.git
b708781..9632c5f main -> main
Mistyped the name in remote add
If you mistype the name in git remote add, the remote is registered but origin is not found. git remote -v showed that it was registered as orgin.
$ git remote add orgin ../server/app3.git
$ git push origin main
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.
$ git remote -v
orgin ../server/app3.git (fetch)
orgin ../server/app3.git (push)
In this case too, you can change the name to the correct one with git remote rename, so you do not need to register the remote again. I created the bare repository ../server/app3.git as the push destination beforehand.
$ git remote rename orgin origin
$ git push origin main
To ../server/app3.git
* [new branch] main -> main
If the message shows a URL, the registered URL is wrong
If the text between ' ' is a URL or path rather than a name, the name is correct, but there is no repository at the registered URL. When I changed the URL of origin to a folder that does not exist (../server/nai.git) and pushed, that URL appeared between the ' '.
$ git remote set-url origin ../server/nai.git
$ git push origin main
fatal: '../server/nai.git' 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.
Fixing the name does not solve this, so correct the URL with git remote set-url. After I did that, the push succeeded (it printed Everything up-to-date because the commits had already been sent).
$ git remote set-url origin ../server/app3.git
$ git push origin main
Everything up-to-date





