Git Push ERROR: Repository not found

  • 5,000
  • Tác giả: admin
  • Ngày đăng:
  • Lượt xem: 5
  • Tình trạng: Còn hàng

remote: Repository not found. can be a frustratingly misleading error message from github when trying lớn push lớn an HTTPS remote where you don't have write permissions.

Check your write permissions on the repository!

Trying an SSH remote lớn 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 lớn 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 lớn prevent the accidental leakage of private repositories lớn 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 lớn bầm is when I am authenticated with GitHub using a credential helper and I have access lớn that repository (having successfully cloned and fetched it) that GitHub would choose lớn hide its existence from bầm 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 lớn the repository. Our team's GitHub administrators were able lớn grant my team write access in a short time and I was able lớn push the branch up.