通道 0 scp 上的子系统请求失败:连接已关闭

问题描述 投票:0回答:3

在终端中运行此命令:

scp -p -P 29418 [email protected]:hooks/commit-msg "jyei-erp/.git/hooks/"

返回以下错误:

通道 0 上的子系统请求失败

scp:连接已关闭

如何解决这个问题?

ssh gerrit scp subsystem
3个回答
73
投票

尝试将 -O 作为 scp cmd 中的选项,即

scp -p -O -P 29418 [电子邮件受保护]:hooks/commit-msg“jyei-erp/.git/hooks/”

面临类似的问题。这个解决方案来自github上关于这个问题的评论。有关更多详细信息 - https://github.com/PowerShell/Win32-OpenSSH/issues/1945


32
投票

在 Linux 上得到了确切的症状。给予

-O
解决了这个问题。来自
scp manpage

     -O      Use the original SCP protocol for file transfers instead of the SFTP protocol.  Forcing the use of the
             SCP protocol may be necessary for servers that do not implement SFTP, for backwards-compatibility for
             particular filename wildcard patterns and for expanding paths with a ‘~’ prefix for older SFTP servers.

10
投票

我也面临这个问题,添加 -O 标志解决了我的问题,正如上面@pysbrg 所说, 最终命令:

scp -p -O -P 29418 [email protected]:hooks/commit-msg "jyei-erp/.git/hooks/"
© www.soinside.com 2019 - 2024. All rights reserved.