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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10922028/
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-10 13:52:28  来源:igfitidea点击:

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

gitgithub

提问by Bentley4

I created a directory, hello_git. In this directory I created a file, hello_git.py, which prints out a "Hello git!" message.

我创建了一个目录,hello_git. 在这个目录中,我创建了一个文件,hello_git.py打印出“Hello git!” 信息。

Then I made hello_gitmy 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 [email protected]:githubaccountname/hello_git.git

When I enter the command git push origin masterI 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 [email protected]) I get this:

当我输入我的密码(使用 成功进行身份验证ssh -T [email protected])时,我得到以下信息:

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

I don't know if this helps, but:

我不知道这是否有帮助,但是:

git remote -v

returns:

返回:

origin    [email protected]:githubaccountname/hello_git.git (fetch)
origin    [email protected]:githubaccountname/hello_git.git (push)

I have looked into answers of similar posts, but nothing seems to work:

我查看了类似帖子的答案,但似乎没有任何效果:

采纳答案by Eric

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. It can't find the repository because it doesn't exist yet!

您需要先在 GitHub 上创建存储库。它找不到存储库,因为它还不存在

回答by jlbang

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 alsogiven by GitHub when the repository doesexist, 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 上已存在该存储库,请确保您使用的帐户有权推送到该存储库。

回答by Zack Xu

Either the repository doesn't exist or you don't have the right permission.

存储库不存在或您没有正确的权限。

More information is on Error: Repository not found.

更多信息是关于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 和多个帐户

回答by Eunwoo Song

Did you perhaps rename your repository? If you renamed your repository on GitHub, you need to update the origin accordingly. This has happened to me once, where I renamed my repository and forgot to update the origin settings in my laptop.

您是否可能重命名了您的存储库?如果您在 GitHub 上重命名了您的存储库,则需要相应地更新源。这在我身上发生过一次,我重命名了我的存储库并忘记更新我的笔记本电脑中的原始设置。

回答by CoolMind

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/ (从浏览器复制)

回答by EntangledLoops

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

回答by Jvieitez

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 功能方面的问题。一旦我们有更多信息要分享,我们就会报告。”