Git Push ERROR: Repository not found

admin

remote: Repository not found. can be a frustratingly misleading error message from github when trying vĩ đại push vĩ đại an HTTPS remote where you don't have write permissions.

Check your write permissions on the repository!

Trying an SSH remote vĩ đại the same repository shows a different response:

% git remote add ssh [email protected]:our-organisation/some-repository.git

% git fetch ssh
From github.com:our-organisation/some-repository
* [new branch]        MO_Adding_ECS_configs             -> ssh/MO_Adding_ECS_configs
* [new branch]        update_gems                       -> ssh/update_gems

% git push ssh     
ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

"The correct access rights?"

Well why didn't you say so?

It's worth noting at this point that while the SSH failure mode in this scenario is slightly better, I use HTTPS remotes over SSH because GitHub recommend HTTPS over SSH.

I understand that GitHub uses "Not Found" where it means "Forbidden" in some circumstances vĩ đại prevent inadvertently reveling the existence of a private repository.

Requests that require authentication will return 404 Not Found, instead of 403 Forbidden, in some places. This is vĩ đại prevent the accidental leakage of private repositories vĩ đại unauthorized users.

--GitHub

This is a fairly common practice around the trang web, indeed it is defined:

The 404 (Not Found) status code indicates that the origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

--6.5.4. 404 Not Found, RFC 7231 HTTP/1.1 Semantics and Content (emphasis mine)

What makes no sense vĩ đại u is when I am authenticated with GitHub using a credential helper and I have access vĩ đại that repository (having successfully cloned and fetched it) that GitHub would choose vĩ đại hide its existence from u because of missing write permissions.

Checking https://github.com/our-organisation/some-repository/ using a web browser confirmed that I didn't have write permissions vĩ đại the repository. Our team's GitHub administrators were able vĩ đại grant my team write access in a short time and I was able vĩ đại push the branch up.