bash 致命:远程服务器意外挂断
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8781682/
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
fatal: remote server hung up unexpectedly
提问by Jaidev Deshpande
I've looked at the other threads with similar questions, but I'm new to git, so most of it didn't make sense :(
我看过其他有类似问题的帖子,但我是 git 新手,所以大部分都没有意义:(
Here's the problem:
这是问题所在:
I can't push a simple readme onto my repository on github.
我无法将简单的自述文件推送到我在 github 上的存储库中。
$ ssh -T [email protected]seems to be working fine.
$ ssh -T [email protected]似乎工作正常。
But whenever I push the README using the following:
但是每当我使用以下内容推送自述文件时:
$ git push origin master
I get the following error -
我收到以下错误 -
ssh: connect to host githum.com port 22: Connection timed out
fatal: The remote end hung up unexpectedly
Notice that it says the host is 'githum.com'. So I must have made a typo when I was setting up the ssh keys for git. How do I correct this and make sure the remote end works properly?
请注意,它说主机是“githum.com”。因此,当我为 git 设置 ssh 密钥时,我一定是打错了。如何更正此问题并确保远程端正常工作?
回答by Mitar
There is a file in .gitdirectory, config. You can fix it there. (You can edit the same with git config -e).
.git目录中有一个文件,config. 你可以在那里修复它。(您可以使用 编辑相同内容git config -e)。
Or use the command to fix the origin:
或者使用命令修复原点:
git remote set-url origin [email protected]:path/to/repo
回答by Robert Rouhani
git remote set-url origin [email protected]:user/test.git
回答by manojlds
You must have set the ssh url for the origin wrong when adding the remote. Do:
添加遥控器时,您必须将源的 ssh url 设置为错误。做:
git remote set-url origin [email protected]:user/repo
to correct.
纠正。
Or just do git config -eor vim .git/configand correct the url in the config directly under [remote "origin"]
或者只是做git config -e或vim .git/config更正配置中的 url[remote "origin"]

