subsystem request failed on channel 0 scp: Connection closed

31.6k Views Asked by At

Running this command in the terminal:

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

returns the following error:

subsystem request failed on channel 0

scp: Connection closed

How can this be fixed?

3

There are 3 best solutions below

3
On BEST ANSWER

Try -O as an option in your scp cmd, i.e.

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

Faced similar issue. This solution is from comments in github regarding this problem. For more details - https://github.com/PowerShell/Win32-OpenSSH/issues/1945

0
On

Got the exact symptom on Linux. Giving -O fixed the issue. From 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.
0
On

I was also facing this issue, adding -O flag fixed my issue as said by @pysbrg already above, final command:

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