在终端中运行此命令:
scp -p -P 29418 [email protected]:hooks/commit-msg "jyei-erp/.git/hooks/"
返回以下错误:
通道 0 上的子系统请求失败
scp:连接已关闭
如何解决这个问题?
尝试将 -O 作为 scp cmd 中的选项,即
scp -p -O -P 29418 [电子邮件受保护]:hooks/commit-msg“jyei-erp/.git/hooks/”
面临类似的问题。这个解决方案来自github上关于这个问题的评论。有关更多详细信息 - https://github.com/PowerShell/Win32-OpenSSH/issues/1945
在 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.
我也面临这个问题,添加 -O 标志解决了我的问题,正如上面@pysbrg 所说, 最终命令:
scp -p -O -P 29418 [email protected]:hooks/commit-msg "jyei-erp/.git/hooks/"