能否请您帮个忙:
当我在终端中运行以下命令时: scp -p -P 29418 michealvern.genzola@192.168.0.122:hooks/commit-msg "jyei-erp/.git/hooks/"
它显示: subsystem request failed on channel 0 scp: Connection closed
请有经验的人士帮助我。
在你的scp命令中尝试使用-O选项,例如:
scp -p -O -P 29418 michealvern.genzola@192.168.0.122:hooks/commit-msg "jyei-erp/.git/hooks/"
我曾经面临过类似的问题。这个解决方案来自于 Github 中有关此问题的评论。了解更多详情,请查看:https://github.com/PowerShell/Win32-OpenSSH/issues/1945
在Linux上出现了完全相同的症状。使用-O
修复了该问题。来自scp手册页
-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.
我也遇到了这个问题,根据 @pysbrg 上面所说的,添加 -O 标志解决了我的问题,最终命令:
scp -p -O -P 29418 michealvern.genzola@192.168.0.122:hooks/commit-msg "jyei-erp/.git/hooks/"
-O
对我来说起作用了,尽管我们的 Gerrit 服务器默认情况下不在克隆命令中包含它。 - undefinedOpenSSH_9.3p2, OpenSSL 3.1.3 19 Sep 2023
之后,之前使用的是ssh7 + openssl 1.1或类似版本。我在WSL上使用的是Ubuntu。据我所知,这个改变是在SSH 8.8版本中进行的,所以在那个版本之后你必须开始使用-O
选项。 - undefined