others-how to solve `remote: Repository not found` error when using git push to remote repository?

1. Purpose

In this post, I would demonstrate how to solve the remote: Repository not found error when using git push to remote repository.

remote: Repository not found.
fatal: repository 'https://github.xxx.com/myapp/kong.git/' not found



2. Solution

When we want to push a git repository to remote, sometimes, we got this error:

➜  kong git:(master) git push
remote: Repository not found.
fatal: repository 'https://github.xxx.com/myapp/kong.git/' not found

environment:

➜  kong git:(master) git version
git version 2.24.3 (Apple Git-128)

Let’s debug:

First, let’s check if git pull is ok:

➜  kong git:(master) git pull
Already up to date.

You can see that git pull is fine.

Let’s check remote branch info:

➜  kong git:(master) git remote -v
origin  https://github.xxx.com/myapp/kong.git (fetch)
origin  https://github.xxx.com/myapp/kong.git (push)
➜  kong git:(master)

github.xxx.com keychains:

In order to trigger the password login again,let’s delete all the keychains related to github.xxx.com.

then git push again:

➜  kong git:(master) git push
Username for 'https://github.xxx.com': bswen
Password for 'https://[email protected]':
remote: Repository not found.
fatal: repository 'https://github.xxx.com/myapp/kong.git/' not found
➜  kong git:(master)

It seems that it might be a permission problem:

This message can occur when a repository IS found, but we don’t have commit access. Not well-worded!

I received the repo-not-found message after cloning a gitHub repository created for me by my boss. I could clone and commit locally, but could not push commits upstream. The repository owner had not given me write access. Solved by a plea for write access to the repo owner.

after contact the repository adminstrator to add my permission, then try again:

➜  kong git:(master) gp
Enumerating objects: 34, done.
Counting objects: 100% (34/34), done.
Delta compression using up to 8 threads
Compressing objects: 100% (33/33), done.
Writing objects: 100% (33/33), 21.74 KiB | 4.35 MiB/s, done.
Total 33 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), done.
To https://github.xxx.com/myapp/kong.git
   f379bb5..9862a06  master -> master



3. Summary

In this post, I demonstrated how to solve the ‘repository not found’ error when trying to push a git repository to remote server. That’s it, thanks for your reading.