rsync fails when there's a space in the directory path
I'm trying to use Rsync to synchronize with a remote server. The rsync configuration says that the connection succeeds.
However, when I attempt to synchronize with the remote, I get the following error.
[12/20/2022 6:53 AM] Upload 'E:\projects\CMakeLists.txt' to '/home/user/CMakeLists.txt' using rsync
[12/20/2022 6:53 AM] "C:\Program Files\Git\usr\bin\rsync.exe" -zar -e "C:\Program Files\Git\usr\bin\ssh.exe -p 22 " --
[12/20/2022 6:53 AM] rsync: [sender] Failed to exec C:\Program: No such file or directory (2)
[12/20/2022 6:53 AM] rsync error: error in IPC code (code 14) at pipe.c(85) [sender=3.2.3]
[12/20/2022 6:53 AM] rsync: connection unexpectedly closed (0 bytes received so far) [sender]
[12/20/2022 6:53 AM] rsync error: error in rsync protocol data stream (code 12) at io.c(228) [sender=
[12/20/2022 6:53 AM] 3.2.3]
This suggests that the executed command isn't getting quoted properly. It's also possible this is a bug in rsync itself.
System Info
- Clion 2022.3
- Windows 11 Pro; Version 22H2; Build 22621.963
- Git 2.38.1.windows.1
Please sign in to leave a comment.
Hello!
Could you please try adding --protect-args to Rsync options? Does it help?
That doesn't resolve the issue (see error below). The issue isn't with rsync's options, it's with how rsync is being called. It's strange because the test button calls rsync just fine. That suggests there's two different bits of code calling the program.
Your setup is quite specific. How did you add rsync to Git?
rsync comes with a standard install of Git for windows. My setup isn't that specific. I imagine there are many developers using this setup. Just not necessarily Clion.
As I mentioned, in the settings dialog the 'test" button returns a success. But when it comes time to synchronize to the remote server, the command fails.
For me it looks like rsync itself is executed (thus the log has [12/21/2022 7:39 AM] rsync:), but can't properly handle "C:\Program Files\Git\usr\bin\ssh.exe -p 22 ".
I ran into the same issue today. I've created a ticket and also posted a workaround there.
I'm surprised with how few people reported this (well, I somehow only ran into this first time myself…).