简体   繁体   English

GitHub:错误:未找到存储库。致命:远程端意外挂断(显然不同于类似的帖子)

[英]GitHub: ERROR: Repository not found. fatal: The remote end hung up unexpectedly (different from similar posts apparently)

I created a directory, hello_git . 我创建了一个目录hello_git In this directory I created a file, hello_git.py , which prints out a "Hello git!" 在这个目录中,我创建了一个文件hello_git.py ,它打印出一个“Hello git!”。 message. 信息。

Then I made hello_git my current directory in the terminal and entered the following commands one after another in that directory: 然后我在终端中创建了hello_git当前目录,并在该目录中一个接一个地输入以下命令:

git init
git add hello_git.py
git commit -m 'first commit'
git remote add origin git@github.com:githubaccountname/hello_git.git

When I enter the command git push origin master I get asked: 当我输入命令git push origin master我被问到:

Enter passphrase for key '/home/myusername/.ssh/id_rsa':

When I enter my passphrase (which authenticates successfully using ssh -T git@github.com ) I get this: 当我输入我的密码(使用ssh -T git@github.com成功验证)时,我得到了:

ERROR: Repository not found.
fatal: The remote end hung up unexpectedly

I don't know if this helps, but: 我不知道这是否有帮助,但是:

git remote -v

returns: 收益:

origin    git@github.com:githubaccountname/hello_git.git (fetch)
origin    git@github.com:githubaccountname/hello_git.git (push)

I have looked into answers of similar posts, but nothing seems to work: 我已经查看了类似帖子的答案,但似乎没有任何效果:

Eric has already given the best answer for this question in the case that the repository does not exist, but I want to point out that: 在存储库不存在的情况下,Eric已经为这个问题给出了最佳答案,但我想指出:

The response pair of "Repository not found. / remote end hung up unexpectedly" is also given by GitHub when the repository does exist, but the user does not have permission to push to it. 当存储库确实存在时,GitHub 也会给出“存储库未找到/远程端意外挂起”的响应对,但用户没有权限推送它。

If you're absolutely certain that the repository already exists on GitHub, make sure the account you're using has permission to push to that repository. 如果您完全确定GitHub上已存在该存储库,请确保您正在使用的帐户具有推送到该存储库的权限。

The error message says it all 错误消息说明了一切

ERROR: Repository not found. 错误:未找到存储库。

Is there a Git repository where you're looking? 你正在寻找一个Git存储库吗?

You need to create the repository on GitHub first. 您需要首先在GitHub上创建存储库。 It can't find the repository because it doesn't exist yet ! 它找不到存储库, 因为它还不存在

Either the repository doesn't exist or you don't have the right permission. 存储库不存在或您没有正确的权限。

More information is on Error: Repository not found . 有关错误:未找到存储库的更多信息。

Also, if you have multiple GitHub accounts (which is actually disallowed), you need multiple ssh keys to be stored with GitHub. 此外,如果您有多个GitHub帐户(实际上不允许),您需要使用多个ssh密钥与GitHub一起存储。

More information is on Quick Tip: How to Work with GitHub and Multiple Accounts . 有关更多信息,请参阅快速提示:如何使用GitHub和多个帐户

Did you perhaps rename your repository? 您是否重命名了您的存储库? If you renamed your repository on GitHub, you need to update the origin accordingly. 如果您在GitHub上重命名了您的存储库,则需要相应地更新源。 This has happened to me once, where I renamed my repository and forgot to update the origin settings in my laptop. 这件事发生在我身上,在那里我重新命名了我的存储库,忘了更新笔记本电脑中的原点设置。

In my case a problem was in a wrong URL. 在我的情况下,问题是在错误的URL中。

Instead of 代替

https://gitlab.com/username/my_repository .git https://gitlab.com/username/my_repository .git

I wrote 我写

https://gitlab.com/username/my_repository/ (copied from a browser) https://gitlab.com/username/my_repository/ (从浏览器复制)

This can also happen if you've stored incorrect credentials. 如果您存储了错误的凭据,也会发生这种情况。 You can clear the repo's memory to be re-prompted on your next push with this: git config --unset credential.helper 您可以清除repo的内存,以便在下次推送时重新提示: git config --unset credential.helper

I just encountered this same issue. 我刚遇到同样的问题。 If none of the other solutions work, it may be because GitHub is having problems with their SSH access, as it says on their status page ( https://status.github.com/ ) 如果其他解决方案都不起作用,可能是因为GitHub的SSH访问存在问题,正如它在状态页面上所述( https://status.github.com/

"We are investigating problems with repository access and some GitHub.com features. We will report back once we have more information to share." “我们正在调查存储库访问和一些GitHub.com功能的问题。一旦我们有更多信息要分享,我们将报告回来。”

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

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