简体   繁体   English

Git远程端意外挂断

[英]Git remote end hung up unexpectedly

I am trying to set up a git repo on my test server when I try to push from my windows computer 当我尝试从我的Windows计算机上推送时,我正试图在我的测试服务器上设置一个git repo

git push ssh://git@server.com:/path/.git

I get the error 我收到了错误

fatal: The remote end hung up unexpectedly

But when I ssh'd into my server and tried to do the the exact same command it worked just fine. 但是,当我进入我的服务器并尝试执行完全相同的命令时,它工作得很好。 Is this a problem with my git setup or with my windows setup 这是我的git设置或我的Windows设置的问题

The problem might be caused by a number of issues: 问题可能是由许多问题引起的:

  • Git is installed in some weird place on the server, and the environment that "git" user gets when being logged in interactively (you do this by hand via PuTTY or whatever) differs from the environment it gets when being logged in non-interactively (the git client does this for you). Git是安装在服务器上的一些奇怪的地方, “混帐”用户,当被记录在交互获取环境(您通过腻子做手工或其他)从被记录非交互时,它得到的环境不同( git客户端为你做这个)。 This is because Unix shells read different startup files in these cases, and when git uses SSH to spawn remote git instance it still spawns the default (for the user) shell on the server. 这是因为在这些情况下Unix shell会读取不同的启动文件,当git使用SSH生成远程git实例时,它仍会生成服务器上的默认shell(对于用户而言)。
  • You have a local problem (say, you configured Git to use plink.exe to access the server, and it asks you to accept the host's key by entering "y" or "n" (which you can't do). 你有一个本地问题(比如,你配置Git使用plink.exe访问服务器,它要求你输入“y”或“n”(你不能这样做)接受主机的密钥。

In any case, try these steps: 无论如何,请尝试以下步骤:

  1. Run plink.exe git@server.com "git --version" and see it's able to run Git on the server at all. 运行plink.exe git@server.com "git --version" ,看看它能够在服务器上运行Git。 If you don't use plink.exe use whatever binary is shipped with OpenSSH included with Git for Windows; 如果您不使用plink.exe使用Git for Windows附带的OpenSSH附带的任何二进制文件; probably it's ssh.exe . 可能是ssh.exe
  2. Export GIT_TRACE=1 before running git push and see if it prints out anything hinting at what went wrong, like this: 在运行git push之前导出GIT_TRACE=1并查看它是否打印出任何暗示出错的内容,如下所示:

     C:\\foo>GIT_TRACE=1 C:\\foo>git push ssh://git@server.com:/path/.git 

我怀疑问题是用户'git'没有对远程存储库的写访问权限,并且您可能使用自己的用户名(cemurray或其他类似用户)手动连接。

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

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