windows Git 致命:远程端挂断

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

Git fatal: remote end hung up

windowsgit

提问by

So I thought I had finally got everything setup on Windows ... then ran into this issue.

所以我以为我终于在 Windows 上设置了所有东西……然后遇到了这个问题。

Current setup

当前设置

URL: ssh://user@host:port/myapp.git

网址:ssh://user@host:port/myapp.git

Already run Putty - and can connect using valid .ppk keys through the ~/.ssh/authorized_keys direct. In Git and TortoiseGIT - I set both to use "plink.exe".

已经运行 Putty - 并且可以通过 ~/.ssh/authorized_keys 直接使用有效的 .ppk 密钥进行连接。在 Git 和 TortoiseGIT 中 - 我将两者都设置为使用“plink.exe”。

Putty works fine - no issues - but when I run that URL into bash I get for a git clone (url)

Putty 工作正常 - 没有问题 - 但是当我将该 URL 运行到 bash 时,我得到了一个 git clone (url)

fatal: the remote end hung up expectedly

致命:远端按预期挂断

In a cygwin bash terminal - running "ssh user@host" - works no probs at all.

在 cygwin bash 终端中 - 运行“ssh user@host” - 根本没有问题。

Anyone suggest anything?

有人建议什么吗?

回答by PatC

I found out that using ssh.exe from the Git package works every time, as opposed to the ssh that comes with cygwin (the default). Using this exported variable seems to help; it's slower (2x or more) but it's more stable. Take it as another workaround.

我发现每次使用 Git 包中的 ssh.exe 都有效,而不是 cygwin 附带的 ssh(默认)。使用这个导出的变量似乎有帮助;它更慢(2 倍或更多),但更稳定。把它当作另一种解决方法。

$ export GIT_SSH=/cygdrive/c/Program\ Files/Git/bin/ssh.exe

$ export GIT_SSH=/cygdrive/c/Program\ Files/Git/bin/ssh.exe

FYI: This version of Msysgit comes with OpenSSH 4.6p1, OpenSSL 0.9.8e. [works] Cygwin's SSH is OpenSSH 5.5p1, OpenSSL 0.9.8n. [doesn't work]

仅供参考:此版本的 Msysgit 附带 OpenSSH 4.6p1、OpenSSL 0.9.8e。[作品] Cygwin 的 SSH 是 OpenSSH 5.5p1,OpenSSL 0.9.8n。[不起作用]

回答by Alex Sh.

I had the same problem with plink for git under windows.

我在 windows 下用 plink for git 遇到了同样的问题。

On run of plink.exe -v [email protected] it started to show Pageant is running. Requesting keys. Pageant has 1 SSH-2 keys login as: <<< trouble

在运行 plink.exe -v [email protected] 时,它开始显示 Pageant 正在运行。索取钥匙。选美有 1 个 SSH-2 密钥登录为:<<< 麻烦

Instead of Pageant is running. Requesting keys. Pageant has 1 SSH-2 keys Using user "xxx"

而不是 Pageant 正在运行。索取钥匙。Pageant 有 1 个 SSH-2 密钥 使用用户“xxx”

To resolve this problem I cleaned up the putty registry records and sessions by putty.exe -cleanup

为了解决这个问题,我通过 putty.exe -cleanup 清理了 putty 注册表记录和会话

After that plink starts afresh and asks to trust and store the host again and it is getting connected with no problem !

在该 plink 重新启动并要求再次信任和存储主机之后,它就可以正常连接了!

回答by Dmitry

Try following steps, maybe something will give you a hint on your problem:
1. Run putty and after setting up server name/user name/keys etc. savethose settings.
2. Run plink.exe or plinkw.exe like plink.exe user_name@server, (it'll throw some info at you) just to see if plink can connect to the server.
3. Check againthat git knows that it should use plink, I'd say with all VCSs, that's the problem people have most often, apart from their keys not being set up properly.
Normally by now most of your ssh problems would be revealed. Now just fix them. :)

尝试以下步骤,也许某些东西会给你一些关于你的问题的提示:
1. 运行 putty 并在设置服务器名称/用户名/密钥等之后保存这些设置。
2. 像plink.exe user_name@server一样运行 plink.exe 或 plinkw.exe ,(它会向你抛出一些信息)只是为了看看 plink 是否可以连接到服务器。
3.再次检查git是否知道它应该使用plink,我想对所有VCS来说,这是人们最常遇到的问题,除了他们的密钥没有正确设置。
通常现在你的大部分 ssh 问题都会暴露出来。现在只需修复它们。:)

Update:

更新:

I think the problem you have is caused by severalgits you've got installed. For the msysgit and cygwin git you'd need to set the GIT_SSH variable. That's done via either 'set GIT_SSH=c:\path\putty\plink.exe' or 'export GIT_SSH=/your/path/putty/putty.exe' respectively. If you're also using tortoise git, you'd need to locate 'properties' (or is it settings?) in it's menu, and set the ssh client there.
Apart from all that, when specifying git clone URL, use your login name and the server name in there, e.g. 'git clone ssh://user@server/your/path/repo.git User and server names should be used by plink, and plink should be able to connect to the server with those arguments, when all of those requirements are met, you'll be all set.

我认为您遇到的问题是由您安装的几个git引起的。对于 msysgit 和 cygwin git,您需要设置 GIT_SSH 变量。这是分别通过“set GIT_SSH=c:\path\putty\plink.exe”或“export GIT_SSH=/your/path/putty/putty.exe”完成的。如果您还使用 tortoise git,则需要在它的菜单中找到“属性”(或者是设置?),然后在那里设置 ssh 客户端。
除此之外,在指定 git clone URL 时,请使用您的登录名和服务器名称,例如 'git clone ssh://user@server/your/path/repo.git plink 应使用用户名和服务器名, 并且 plink 应该能够使用这些参数连接到服务器,当满足所有这些要求时,您就可以了。

Good luck.

祝你好运。

回答by eisd

If you want to try the cygwin openssh 5.4p1-1, which does seem to work for this, unlike 5.5 or 5.6, you can use the cygwin time machinemirrors. Start setup.exe with -X and add a mirror Url, such as:

如果您想尝试 cygwin openssh 5.4p1-1,它似乎对此有效,与 5.5 或 5.6 不同,您可以使用cygwin 时间机器镜像。用-X启动setup.exe并添加镜像Url,如:

ftp://www.fruitbat.org/pub/cygwin/circa/2010/05/20/230133

Be careful not to install too much, i.e. base packages, from an older mirror than the rest of your install.

小心不要从较旧的镜像安装太多,即基础包,而不是安装的其余部分。

回答by ZAJDAN

We had same problem and here is solution how we solved the problem:

我们遇到了同样的问题,这是我们如何解决问题的解决方案:

at first we got:

起初我们得到:

zajdan@cyberFuture:~$ git clone ssh://[email protected]/~repos/erotika.git/ erotika
Initialized empty Git repository in /home/zajdan/erotika/.git/
Password: 
fatal: '/repos/erotika.git': unable to chdir or not a git archive
fatal: The remote end hung up unexpectedly
zajdan@cyberFuture:~$ 

solution:

解决方案:

zajdan@cyberFuture:~$ git clone ssh://[email protected]/~/repos/erotika.git/ erotika

after tilde there must be a slash!

在波浪号之后必须有一个斜线

回答by Kangur

Try to use absolute path to repo in a URL, that worked for me.

尝试使用绝对路径在 URL 中进行 repo,这对我有用。

Instead of:

代替:

git ssh://user@host:port/myapp.git

Write:

写:

git ssh://user@host:port//home/user/repo/myapp.git

Notice the double slash!

注意双斜线!

回答by Jerry Asher

I believe the real problem is that cygwin's ssh looks for .ssh in /home/name/.ssh and mingw's git ssh looks for .ssh in c:/user/name/.ssh

我相信真正的问题是 cygwin 的 ssh 在 /home/ name/.ssh 中寻找 .ssh 而 mingw 的 git ssh 在 c:/user/ name/.ssh 中寻找 .ssh

Chances are your keys are in one and only one of these directories.

您的密钥可能位于这些目录中的一个且只有一个。

You can trying telling cygwin's .ssh to use a different identity file using the -i switch, or move the keys into both directories, or create an ssh config file in /home/name/.ssh/config.

您可以尝试使用 -i 开关告诉 cygwin 的 .ssh 使用不同的身份文件,或者将密钥移动到两个目录中,或者在 /home/ name/.ssh/config 中创建一个 ssh 配置文件。

I created a config that contains:

我创建了一个包含以下内容的配置:

Host github.com
    User jerryasher
    Hostname github.com
    IdentityFile c:/Users/jerry/.ssh/id_rsa

And given that I can use either the mingw git from git bash or cygwin's git from an rxvt to interact with github.

鉴于我可以使用 git bash 中的 mingw git 或 rxvt 中的 cygwin git 与 github 交互。

回答by octane097

To correct this issue, run "plink -agent github.com" Press y when prompted to cache the key. Login as git. You'll automatically be disconnected. And it sould work.

要解决此问题,请运行“plink -agent github.com”。在提示缓存密钥时按 y。以 git 身份登录。您将自动断开连接。它确实有效。

Source: http://devlicio.us/blogs/sergio_pereira/archive/2009/05/06/git-ssh-putty-github-unfuddle-the-kitchen-sink.aspx

资料来源:http: //devlicio.us/blogs/sergio_pereira/archive/2009/05/06/git-ssh-putty-github-unfuddle-the-kitchen-sink.aspx

回答by Bartosz Firyn

I get message: "remote end gung-up, unexpected EOFs, index-pack failed" while cloning git repo but was able to workaround this issue with copssh http://sourceforge.net/projects/sereds/files/Copssh

我在克隆 git repo 时收到消息:“远程端发生故障,意外的 EOF,索引包失败”,但能够使用 copssh http://sourceforge.net/projects/sereds/files/Copssh解决此问题

The root cause is Cygwin openssh package.

根本原因是 Cygwin openssh 包。

I removed original openssh from Cygwin, installed copssh and set GIT_SSH variable to point copssh binaries. After this I simply added copssh binaries in the PATH and now I'm using copssh instead of openssh - there is no difference.

我从 Cygwin 中删除了原始的 openssh,安装了 copssh 并设置了 GIT_SSH 变量以指向 copssh 二进制文件。在此之后,我只是在 PATH 中添加了 copssh 二进制文件,现在我使用的是 copssh 而不是 openssh - 没有区别。

Everything works fine and issue does not appear any more.

一切正常,问题不再出现。

The other solution is to use mSysGit package.

另一种解决方案是使用 mSysGit 包。

回答by e40

I have exactly the same issue.

我有完全相同的问题。

I don't use Putty (just Cygwin). I use Windows 7 Ultimate (fully patched as of this moment). I just installed Cygwin yesterday.

我不使用腻子(只是 Cygwin)。我使用 Windows 7 Ultimate(目前已完全修补)。我昨天刚刚安装了 Cygwin。

I made sure binary mounts were being used.

我确保正在使用二进制安装。

If I copy a git repo to the machine (via samba mount), I can clone it, but when I "git diff" after the clone, there are a bunch of "different" files with no diffs. After a "git status" there was no output from "git diff". It seems like a newline thing, but I can't figure out how that would be happening. (I have igncr in SHELLOPTS, but removing that doesn't fix it.)

如果我将 git repo 复制到机器上(通过 samba mount),我可以克隆它,但是当我在克隆后“git diff”时,有一堆没有差异的“不同”文件。在“git status”之后,“git diff”没有输出。这似乎是一个换行符,但我无法弄清楚这将如何发生。(我在 SHELLOPTS 中有 igncr,但删除它并不能解决它。)

I'm completely stumped.

我完全被难住了。