带有 https 错误的 git clone - 致命:未找到存储库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/42445703/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 12:37:55  来源:igfitidea点击:

git clone with https error - fatal: repository not found

gitgithubhttpsgit-clone

提问by shaleshock

I forked a privaterepository that I was invited to collaborate on but every time I try to clone with HTTPS, I get the following error message:

我分叉了一个我被邀请参与协作的私有存储库,但每次我尝试使用 HTTPS进行克隆时,我都会收到以下错误消息:

$ git clone https://github.com/usernamex/privat-repo.git
cloning into 'privat-repo'...
Username for 'https://github.com':usernamex
Password for 'https://[email protected]':
remote: Repository not found.
fatal: repository 'https://github.com/usernamex/privat-repo.git/' not found


Note: 'usernamex' and 'privat-repo' are just examples

Note: 'usernamex' and 'privat-repo' are just examples



Here's some things I have tried with no success:

以下是我尝试过但没有成功的一些事情:

  • Verified the validity of the URL - Checked spelling and case. I am able to access the repo URL and download its contents through my browser by clicking the download ZIPbutton.
  • Asked owner to clone my fork - He had no problems cloning my fork but I do.
  • Contacted GitHub support...
  • Per GitHub support, cleared cached credentials- this is confirmed by the fact that the system requires my username and password with git cloneand git push. In fact, I can clone and push other (public) repositories in my account.
  • Went through GitHub's HTTPS Cloning Errorsguide with the exception of "Using SSH instead"because this doesn't really address the issue.
  • Viewed similar questions in stackoverflow.com - tried most suggested answers (see above).
  • 验证 URL 的有效性 - 检查拼写和大小写。我可以通过单击download ZIP按钮访问 repo URL 并通过浏览器下载其内容。
  • 要求所有者克隆我的叉子 - 他克隆我的叉子没有问题,但我有。
  • 联系了 GitHub 支持...
  • 根据 GitHub 支持,清除缓存的凭据- 系统需要我的用户名和密码以及git clone和的事实证实了这一点git push。事实上,我可以在我的帐户中克隆和推送其他(公共)存储库。
  • 浏览了 GitHub 的HTTPS 克隆错误指南,但“使用 SSH 代替”除外,因为这并没有真正解决问题。
  • 在 stackoverflow.com 中查看了类似的问题 - 尝试了大多数建议的答案(见上文)。

I am running git 2.10 on a mac through Terminal and, as I mentioned, I am not interested in workarounds to HTTPS (e.g.: SSH or GitHub Desktop).

我通过终端在 Mac 上运行 git 2.10,正如我所提到的,我对 HTTPS 的解决方法不感兴趣(例如:SSH 或 GitHub Desktop)。

Any ideas why this is happening?

任何想法为什么会发生这种情况?

回答by Pejman

This Github documentreads:

这个 Github 文档这样写的:

The https://clone URLs are available on all repositories, public and private.

https://克隆网址,可在所有存储库,公共和私人。

But since you are trying to access a private repository, authentication is required. One way is appending username and password the address as below:

但是由于您尝试访问私有存储库,因此需要进行身份验证。一种方法是将用户名和密码附加到如下地址:

git clone https://username:[email protected]/usernamex/privat-repo.git

But the same pagereads:

同一页上写着:

If you have enabled two-factor authentication, or if you are accessing an organization that uses SAML single sign-on (SSO), you must authenticate with a personal access token instead of your username and password for GitHub.

如果您启用了双因素身份验证,或者您正在访问使用 SAML 单点登录 (SSO) 的组织,则必须使用个人访问令牌而不是 GitHub 的用户名和密码进行身份验证。

If you have 2FA enabled, check this pagefor steps to generate a personal access token. Bear in mind that you should check full reposcope (as shown below) for your personal token.

如果您启用了 2FA,请查看此页面以了解生成个人访问令牌的步骤。请记住,您应该检查repo个人令牌的完整范围(如下所示)。

enter image description here

在此处输入图片说明