Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Commands working on windows command line but not in Git Bash terminal

Tags:

git

python

bash

I am trying to run certain commands in Git Bash but they continue to hang and not display anything. When I run them in the Windows command prompt they work.

For example, in my windows command prompt the

Microsoft Windows [Version 10.0.10586]
(c) 2015 Microsoft Corporation. All rights reserved.

C:\Users\danie>python.exe
Python 2.7.11 |Anaconda 4.0.0 (64-bit)| (default, Feb 16 2016, 09:58:36) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks an d https://anaconda.org
>>>

and in Git Bash it just hangs...

danie@DESKTOP-36I511A MINGW64 ~
$ python

I have tried navigating directly in to the folders where the commands exist, trying 'python.exe', and waiting.

I have also looked at the PATH variables for Git Bash, and python.exe is inside of the Anaconda2 folder which I can see below when I run env|grep PATH.

danie@DESKTOP-36I511A MINGW64 ~
$ env|grep PATH
HOMEPATH=\Users\danie
MANPATH=/mingw64/share/man:/usr/local/man:/usr/share/man:/usr/man:/share/man:
PATH=/c/Users/danie/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/danie/bin:/c/Program Files/Dell/DW WLAN Card:/c/Program Files (x86)/Intel/iCLS Client:/c/Program Files/Intel/iCLS Client:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/DAL:/c/Program Files/Intel/Intel(R) Management Engine Components/DAL:/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/IPT:/c/Program Files/Intel/Intel(R) Management Engine Components/IPT:/c/Program Files/WIDCOMM/Bluetooth Software:/c/Program Files/WIDCOMM/Bluetooth Software/syswow64:/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/c/Program Files (x86)/Skype/Phone:/c/Program Files/Microsoft SQL Server/Client SDK/ODBC/110/Tools/Binn:/c/Program Files (x86)/Microsoft SQL Server/120/Tools/Binn:/c/Program Files/Microsoft SQL Server/120/Tools/Binn:/c/Program Files/Microsoft SQL Server/120/DTS/Binn:/c/Program Files (x86)/Microsoft SQL Server/120/Tools/Binn/ManagementStudio:/c/Program Files (x86)/Microsoft SQL Server/120/DTS/Binn:/c/Users/danie/Anaconda2:/c/Users/danie/Anaconda2/Scripts:/c/Users/danie/Anaconda2/Library/bin:/c/Users/danie/SQLite:/usr/bin/vendor_perl:/usr/bin/core_perl
EXEPATH=C:\Program Files\Git
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
PKG_CONFIG_PATH=/mingw64/lib/pkgconfig:/mingw64/share/pkgconfig
ACLOCAL_PATH=/mingw64/share/aclocal:/usr/share/aclocal
INFOPATH=/usr/local/info:/usr/share/info:/usr/info:/share/info:

This happens with other commands too. Sometimes adding "interactive" helps, other times it doesn't. Any idea what is going on?

like image 853
dgloven Avatar asked May 13 '16 06:05

dgloven


People also ask

How do I run Git Bash from Windows command line?

Launch Git Bash console by clicking on the Start button, type git, and click on Git Bash. 2. Run the below git config command to add your name ( YourName ) as your git username ( user.name ). The git config command administers configuration variables that control how Git looks and operates.

Can I use Git Bash instead of CMD in Windows?

You don't need to use Git Bash. It is just conventional, because Git was developed and designed on Linux and most Git users use Linux and using Git Bash on Windows makes it a uniform experience. You can certainly use Git on cmd; just make sure you add C:\Program Files\git\cmd to your PATH .

Why does my terminal not recognize Git?

If the Git path is not configured correctly, you could also receive the error “git is not recognized as an internal or external command, operable program or batch file”. You can try reinstalling Git for Windows to set the path automatically.

Why Git Bash is not opening?

Open CMD as Admin. CD to the installation path of GitHub (e.g. CMDPRMPT> CD "C:\Program Files\Git") Run "git-bash.exe" from command prompt. Right-click the GIT BASH icon on the taskbar and pin it so you can avoid steps 1-3 in the future.


1 Answers

Update: I ended up just aliasing the problematic windows commands (python, sqlite3, and some others) to get around typing winpty. Hopefully this is an OK solution.

To do this, I created a .bash_profile file in the home directly for Git Bash, and did something like this for each command: alias sqlite3='winpty sqlite3.exe'

like image 76
dgloven Avatar answered Sep 24 '22 00:09

dgloven