The Problem
When I enter the command android in the normal Windows command prompt, android.bat is launched from the a directory I included in the PATH-variable.
When I enter the same command in the msysgit Git Bash, the bash complains:
sh.exe": android: command not found
android is the only command that has this problem, all others work on both shells (the directory it is contained in is android-sdk/tools )
Working examples are node, npm, heroku.
My environment
This is what echo $PATH returns in Git Bash:
/c/Users/Tobias/bin:.:/usr/local/bin:/mingw/bin:/bin:/c/Users/Tobias/AppData/Local/apache-ant-1.9.4/bin:/cmd:/c/Program Files/nodejs/:/c/Python27:/c/Python34/:/c/Python34/Scripts:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/c/Program Files (x86)/ATI Technologies/ATI.ACE/Core-Static:/c/Program Files (x86)/Common Files/Acronis/SnapAPI/:/c/Program Files (x86)/Heroku/bin:/c/Program Files/Java/jdk1.8.0_11/bin:/c/Ruby200-x64/bin:/c/Users/Tobias/AppData/Roaming/npm:/c/Users/Tobias/AppData/Local/Android/android-sdk/tools:/c/Users/Tobias/AppData/Local/Android/android-sdk/platform-tools:.
This is what echo %PATH% returns in Windows CMD:
C:\Users\Tobias\AppData\Local\apache-ant-1.9.4\bin;C:\Program Files (x86)\git\cmd;C: \Program Files\nodejs\;C:\Python27;C:\Python34\;C:\Python34\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Common Files\Acronis\SnapAPI\;C:\Program Files (x86)\Heroku\bin;C:\Program Files\Java\jdk1.8.0_11\bin;C:\Ruby200-x64\bin;C:\Users\Tobias\AppData\Roaming\npm;C:\Users\Tobias\AppData\Local\Android\android-sdk\tools;C:\Users\Tobias\AppData\Local\Android\android-sdk\platform-tools;
Seems like msysgit can't access files inside C:\Users\x\AppData\Roaming.
I fixed the issue by moving the directory directly in the C: drive.
Related
Git Bash no longer recognizes git commands, as well as some commands like ls and env. I've checked that the following paths were set up in my environment variables and I've tried uninstalling/reinstalling git.
Paths that are present:
C:\Program Files\Git\bin
C:\Program Files\Git\cmd
I would like to note that I am only having this issue with Git Bash. I've tried using git commands through Command Prompt, and everything seems to work there.
I am using git bash on a windows machine. Everything works normally except for the whereis command. The terminal tells me the command is not found:
$ whereis grep
bash: whereis: command not found
I have already tried adding C:\Program Files(x86)\Git\bin to my PATH.
How do I fix this?
Use the where in Windows
Utilized the command whereis in Linux is equals that command where , provided for the Windows kit for Windows 98, and is included by default in Server 2003, Vista, and newer versions :
$ where git
C:\Program Files\Git\mingw64\bin\git.exe
C:\Users\MyUser\scoop\shims\git.exe
More information
Equivalent whereis in Windows
where.html
Add the .exe in gitbash for Windows
While you want an executable of the type .exe in gitbash you should be add in the follow path relation :
C:\Program Files\Git\mingw64\bin\<EXE>.exe
Or where there is ubication the folder git but always should be add in mingw64\bin\.
Install whereis in Windows
You must download the following file:whereis.zip
Once unzipped, you should copy the whereis.exe file that is in :
mvp_tips/whereis/Debug/
And copy it in :
C:\Program Files\Git\mingw64\bin\
If all went well, close all the GitBash tabs and reopen one of them and enter :
$ whereis whereis
C:\Program Files\Git\mingw64\bin\whereis.exe #And what should come out if everything is correct:
Script for download and installation
Run the Git Bash as Run As Administrator
#!/bin/bash
wget www.flounder.com/whereis.zip
unzip whereis.zip
cd mvp_tips/whereis/Debug/
cp whereis.exe 'C:\Program Files\Git\mingw64\bin\'
source ~/.bashrc
whereis whereis
Command 'ls' not working in windows
Getting an error while executing 'ls'
'ls' is not recognized as an internal or external command, operable
program or batch file.
Use the command dir to list all the directories and files in Windows; ls is a unix command.
Please follow below steps to fix this
download and install git
https://git-scm.com/downloads.
After git installation is completed,navigate to folder where git is installed. Check in C/Program Files Folder.
Navigate to C:\Program Files\Git\bin
Add the above location (C:\Program Files\Git\bin) in path variable in system environment variables.
Restart cmd and try to run ls and other Linux commands.
It should work now!!`
We don't use ls(List) command in windows.
Instead of using ls command use dir(Directory) command.
This command also displays the total number of files and directories
listed.
NOTE:
We can use ls command in Windows PowerShell. It works in PowerShell, shows the files and directories listed.
I'm using Git Bash on Windows and just moving my files around locally. Here's my folder path:
/e/Python/Python---CS-170/CS170_homework/
I tried to move my files from Python---CS-170 to the sub folder CS170_homework and it a bit of curiousity, I typed this:
mv Python---CS-170/CS170_homework /
Now all the content in the folder Python---CS-170 is moved somewhere. Can you tell me where the files are moved to? I know the place it went to is "/", but what does it mean?
Can you try running on the Git Bash these commands:
cygpath -w /
On my system I am getting output as:
C:\Program Files\Git\
You can navigate to the folder using explorer to find the files you are looking for.
Here is the documentation for the utility.
I am trying to move from a mac environment to a windows one and require rsync.
Found cwrsync # http://www.rsync.net/resources/howto/windows_rsync.html
I have installed the cwrsync program fine, I can call the rsync at cmd but on when in the directory which contains the sync.exe
When in command prompt, if i call rsync when not in the relavent directory it moans and sayS:
"rsync" is not recognised as an internal or external command, operable
program or batch file.
Is there a way to add the rsync.exe to a global list so as rsync is recognised outside of its immediate parent directory?
Thanks,
John
Add the path in the Windows system variables:
- Control Panel -> System -> tab Advanced, button Environment Variables.
- Edit the "Path" system variable and add the full path to the installed rsync:
C:\Program Files\cwRsync\bin or C:\cygwin\bin. or
C:\Program Files (x86)\cwRsync\bin or C:\cygwin\bin.
This way the commands rsync and ssh should run from any directory. Make sure you put in the correct install path to the application else it won't work. See screenshot below:
Environment Variable Setup: Make sure the path you added is under System Variables:
Command: As seen, I am running this directly from root of C: drive
cwRsync distribution contains a batch file example called cwrsync.cmd with correct path settings. You can simply add your rsync command into that file.