When I run some code in git bash, I found the path was changed automatically.
$ python src/loon/skeleton.py upload ~/test.R /tmp -v
[2019-11-03 10:41:07] INFO:__main__:Starting loon...
[2019-11-03 10:41:07] INFO:__main__:Upload command is detected.
=> Starting upload...
[2019-11-03 10:41:07] INFO:__main__:Running scp -pr -P 22 C:/Users/Administrator/test.R [email protected]:C:/Users/ADMINI~1/AppData/Local/Temp/
scp: C:/Users/ADMINI~1/AppData/Local/Temp/: No such file or directory
[2019-11-03 10:41:08] INFO:__main__:Status code: 1
Error: an error occurred, please check the info!
/tmp here is a path on remote host. You can see /tmp is changed to C:/Users/ADMINI~1/AppData/Local/Temp/. I can't prevent it by either add ' or ".
$ python src/loon/skeleton.py upload ~/test.R '/tmp' -v
[2019-11-03 10:43:17] INFO:__main__:Starting loon...
[2019-11-03 10:43:17] INFO:__main__:Upload command is detected.
=> Starting upload...
[2019-11-03 10:43:17] INFO:__main__:Running scp -pr -P 22 C:/Users/Administrator/test.R [email protected]:C:/Users/ADMINI~1/AppData/Local/Temp/
scp: C:/Users/ADMINI~1/AppData/Local/Temp/: No such file or directory
[2019-11-03 10:43:19] INFO:__main__:Status code: 1
Error: an error occurred, please check the info!
This is because Git-Bash is trying to be helpful and converting Linux looking paths to their Windows equivalent.
If you add MSYS_NO_PATHCONV=1 to the beginning of your command, it will tell git-bash to not replace /tmp with your Temp directory.
Your command will look like this:
MSYS_NO_PATHCONV=1 python src/loon/skeleton.py upload ~/test.R /tmp -v
The solution is based on another question.
In addition, as stated by @mpen, you can add export MSYS_NO_PATHCONV=1 to C:/Users/$USERNAME/.bashrc to prevent this globally.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With