简体   繁体   English

推送到远程私人仓库:致命:未找到存储库

[英]pushing to remote private repo : fatal: repository not found

I successfully cloned remote private repo via 我通过成功克隆了远程私人仓库

git clone https://github.com/notMyUsername/repoName

I recieved all the files from the repo - so there is no mistake in url 我收到了回购邮件中的所有文件 - 所以网址没有错误

but when I am trying to push I get next errors: 但当我试图推动时,我得到下一个错误:

$ git push --dry-run
remote: Repository not found.
fatal: repository 'https://github.com/notMyUsername/repoName/' not found

$ git push origin --dry-run
remote: Repository not found.
fatal: repository 'https://github.com/notMyUsername/repoName/' not found

$ git remote -v
origin  https://github.com/notMyUsername/repoName (fetch)
origin  https://github.com/notMyUsername/repoName (push)

I also received notification from github for this repo, which tells that "You were automatically subscribed because you've been given push access to the repository." 我还收到了github关于这个repo的通知,它告诉你“你被自动订阅了,因为你已经获得了对存储库的推送访问权限。” So I have rights. 所以我有权利。

What's wrong here? 这有什么不对?

You probably don't have push rights on the GitHub repo, or you're not authenticated at all (but because you cloned, I assume you're authenticated). 您可能没有GitHub仓库的推送权限,或者您根本没有经过身份验证(但因为您克隆了,我认为您已经过身份验证)。

As described by GitHub ( https://developer.github.com/v3/troubleshooting/ ), the GitHub API returns 404 for errors, not 403: 如GitHub( https://developer.github.com/v3/troubleshooting/ )所述,GitHub API返回404错误,而不是403:

Why am I getting a 404 error on a repository that exists? 为什么我在存在的存储库上收到404错误?

Typically, we send a 404 error when your client isn't properly authenticated. 通常,当您的客户端未经过正确身份验证时,我们会发送404错误。 You might expect to see a 403 Forbidden in these cases. 在这些情况下,您可能会看到403 Forbidden。 However, since we don't want to provide any information about private repositories, the API returns a 404 error instead. 但是,由于我们不想提供有关私有存储库的任何信息,因此API会返回404错误。

To troubleshoot, ensure you're authenticating correctly, your OAuth access token has the required scopes, and third-party application restrictions are not blocking access. 要进行故障排除,请确保您正确进行身份验证,您的OAuth访问令牌具有所需的范围,并且第三方应用程序限制不会阻止访问。

You can only push to your own repositories on GitHub unless the repository owner has given you the right to push to that repository. 除非存储库所有者已授予您推送到该存储库的权限,否则您只能在GitHub上推送到您自己的存储库。

I contacted github support and they told me to check my git credentials in Windows Credential Manager if I am using a windows machine. 我联系了github支持,如果我使用的是Windows机器,他们告诉我在Windows Credential Manager中查看我的git凭据。 Seems that somehow the git credentials were incorrect. 似乎某种方式git凭据不正确。 I corrected the credentials and push worked. 我更正了凭据并推动了工作。 In a mac i guess the keychain would have the credentials. 在mac中,我猜钥匙串将具有凭证。

Now it fixed, and I did nothing(only wrote a message to the github support). 现在它修复了,我什么都没做(只给github支持写了一条消息)。 And I saw some similar questions here on stackoverflow, where only time helped too. 我在stackoverflow上看到了一些类似的问题,其中只有时间也有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM