2

I installed git for windows on a Windows 7 host. The Git for Windows comes with a program called git bash. I can use scp to transfer files to a Linux host in a git bash Window, as follows:

 MINGW64 ~
 $ scp  from-windows-file  linuxuser@LINUX-HOST-IP:/home/linuxuser/

But when I transfer files back to a Git Bash window from a Linux host, scp not work, as follows:

 $ scp  from-linux-file   winuser@WINDOWS-HOST-IP:/c/Users/winuser/

I got an error:

ssh: connect to host WINDOWS-HOST-IP port 22: Connection refused
lost connection

How can I transfer files back to a Git Bash window from a Linux host?

2 Answers 2

1

You should remain in mingw64-shell and do:

$ scp linuxuser@LINUX-HOST-IP:/home/linuxuser/from-linux-file .

It will copy the file to the current directory keeping the filename.

1

The reason for ssh: connect to host WINDOWS-HOST-IP port 22: Connection refused is because your Windows doesn't have an SSH server running. So the solution is to keep an SSH server running as a service to listen to SSH connections. Windows 10 has a built-in OpenSSH server so no need to install a server anymore

Alternatively you can copy from Linux, just swap the source and destination

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .