I'm trying to pass a unix style path to the Android adb command using a git bash (msysgit) but the shell is interpreting my path incorrectly. This is what I've tried so far:
$ adb push myfile /mnt/sdcard/
failed to copy 'myfile' to 'C:/Program Files (x86)/Git/mnt/sdcard/': No such file or directory
$ adb push myfile "/mnt/sdcard/"
failed to copy 'myfile' to 'C:/Program Files (x86)/Git/mnt/sdcard/': No such file or directory
$ adb push myfile '/mnt/sdcard/'
failed to copy 'myfile' to 'C:/Program Files (x86)/Git/mnt/sdcard/': No such file or directory
What is the correct way to do this?
Click on Advanced System Settings. Click on Environment Variables. Under System Variables, look for the path variable and click edit. Add the path to git's bin and cmd at the end of the string like this: ;C:\Program Files\Git\bin\git.exe;C:\Program Files\Git\cmd.
Go to File > Preferences > Settings and type shell in search settings. After that, navigate to Terminal > Integrated > Shell:Windows and update the path with Git Bash executable: C:\Program Files\Git\bin\bash.exe and save. Reopen VS Code terminal and it will prompt Git Bash.
Using Windows Explorer, navigate to any directory you want, type "cmd" in the address bar it will open Windows command prompt in that directory. Along the same lines, if you have the git directory in your path, you can type "git-bash" in the address bar and a Git Shell will open in that directory.
According to this answer, the MSYS shell is mangling the file name according to these rules. According to the mangling rules, the following should work for you:
adb push myfile '//mnt\sdcard\'
(replace the first slash with two slashes and all remaining slashes with a backslash)
adb push myfile //mnt/sdcard
linux isn't picky about duplicate /
s
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