简体   繁体   中英

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

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

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). 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.
  • 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).

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. If you don't use plink.exe use whatever binary is shipped with OpenSSH included with Git for Windows; probably it's 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:

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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