threads / bug / 46385

Git Bash Bug

Subject: Git Bash Bug

## tl;dr

9 messages between Jul 14, 2017 and Jul 14, 2017.

replies: 8people: 3as markdown or json

Kavita Desai· Jul 14, 2017, 13:43 UTC · lore
Hello,

Originally, when I first had Git Bash everything was working perfectly. Randomly one day, my bash commands were not working. I uninstalled Git Bash an reinstalled it. I have been trying for 3 weeks to get it to work again. I am working on Windows 10. I have tried editing the PATH variables and the PATH environment variables and nothing seems to be working. Do you have any other suggestions?

Thank you,
Kavita
Johannes Schindelin· Jul 14, 2017, 14:28 UTC · re: Kavita Desai · lore

Re: Git Bash Bug

Hi Kavita,
On Fri, 14 Jul 2017, Kavita Desai wrote:
> Originally, when I first had Git Bash everything was working
> perfectly. Randomly one day, my bash commands were not working.

There are a gazillion ways how commands can "not work". You *need* to be more specific here. In the least, a precise pasted output of a failed command is necessary.

In addition, a couple of other points of interest would be good to know, the issue reporting template at https://github.com/git-for-windows/git/issues/new tries to help you provide as much important information as you can. Maybe give it a try?

Ciao, Johannes

Kavita Desai· Jul 14, 2017, 14:34 UTC · re: Johannes Schindelin · lore

Re: Git Bash Bug

Sorry for not being specific. What I meant by not working was that the bash commands are not found. Here is an example

$ ls bash: ls: command not found

Kavita

On Fri, Jul 14, 2017 at 9:28 AM, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:

Show 18 quoted lines
> Hi Kavita,
>
> On Fri, 14 Jul 2017, Kavita Desai wrote:
>
>> Originally, when I first had Git Bash everything was working
>> perfectly. Randomly one day, my bash commands were not working.
>
> There are a gazillion ways how commands can "not work". You *need* to be
> more specific here. In the least, a precise pasted output of a failed
> command is necessary.
>
> In addition, a couple of other points of interest would be good to know,
> the issue reporting template at
> https://github.com/git-for-windows/git/issues/new tries to help you
> provide as much important information as you can. Maybe give it a try?
>
> Ciao,
> Johannes
-- 
Kavita Desai
UIUC Engineering Physics 2018
Engineering Outreach Society Engineering Open House Chair
UIUC Housing Ike. South Front Desk Clerk
Paul Smith· Jul 14, 2017, 14:37 UTC · re: Kavita Desai · lore

Re: Git Bash Bug

On Fri, 2017-07-14 at 09:34 -0500, Kavita Desai wrote:
Show 6 quoted lines
> Sorry for not being specific. What I meant by not working was that the
> bash commands are not found.
> Here is an example
> 
> $ ls
> bash: ls: command not found
The most obvious issue is your PATH is wrong.
What does "echo $PATH" show?
What does "type -a ls" show?
Kavita Desai· Jul 14, 2017, 14:59 UTC · re: Paul Smith · lore

Re: Git Bash Bug

Here are the results.

What does "echo $PATH" show? /c/Users/Kavita/

What does "type -a ls" show? ls is aliased to `ls -F --color=auto --show-control-chars'

On Fri, Jul 14, 2017 at 9:37 AM, Paul Smith <paul@mad-scientist.net> wrote:
Show 13 quoted lines
> On Fri, 2017-07-14 at 09:34 -0500, Kavita Desai wrote:
>> Sorry for not being specific. What I meant by not working was that the
>> bash commands are not found.
>> Here is an example
>>
>> $ ls
>> bash: ls: command not found
>
> The most obvious issue is your PATH is wrong.
>
> What does "echo $PATH" show?
>
> What does "type -a ls" show?
-- 
Kavita Desai
UIUC Engineering Physics 2018
Engineering Outreach Society Engineering Open House Chair
UIUC Housing Ike. South Front Desk Clerk
Paul Smith· Jul 14, 2017, 15:03 UTC · re: Kavita Desai · lore

Re: Git Bash Bug

On Fri, 2017-07-14 at 09:59 -0500, Kavita Desai wrote:
> What does "echo $PATH" show?
> /c/Users/Kavita/
Well, there you go.  That's clearly wrong.

You absolutely have to have /bin and /usr/bin on your PATH, _at least_ if you want to be able to run standard UNIX tools. And most likely you'll have a ton of other directories on your PATH as well.

I would investigate the shell configuration files etc. and see where you've messed up resetting your PATH variable.

> What does "type -a ls" show?
> ls is aliased to `ls -F --color=auto --show-control-chars'
Yep.  There is no ls binary found.
Johannes Schindelin· Jul 14, 2017, 20:33 UTC · re: Paul Smith · lore

Re: Git Bash Bug

Hi,
On Fri, 14 Jul 2017, Paul Smith wrote:
Show 7 quoted lines
> On Fri, 2017-07-14 at 09:59 -0500, Kavita Desai wrote:
> > What does "echo $PATH" show?
> > /c/Users/Kavita/
> 
> Well, there you go.  That's clearly wrong.
> 
> You absolutely have to have /bin and /usr/bin on your PATH,

As Kavita talks about Git Bash, it is probably Git for Windows, for which /bin should not be in the PATH but /mingw64/bin or /mingw32/bin (depending on the architecture).

It may be messed up by some strange setting in the User Environment. Go to the Windows Explorer, right-click on "This PC", select "Properties", in the newly-opened window ("Control Panel>All Control Panel Items>System"), next to the "Computer name, domain, and workgroup settings" select "Change settings" which brings up the "System Properties" window, in whose "Advanced" tab is an "Environment Variables" button.

(Or hit the Windows key, type "Edit the system environment variables")

You should find the "Path" variable at least in the System variables. It is case-insensitive, so if your User variables contain, say, an empty value for a key "paTH", then the riddle is solved.

Ciao, Johannes

Paul Smith· Jul 14, 2017, 21:12 UTC · re: Johannes Schindelin · lore

Re: Git Bash Bug

On Fri, 2017-07-14 at 22:33 +0200, Johannes Schindelin wrote:
Show 5 quoted lines
> > You absolutely have to have /bin and /usr/bin on your PATH,
> 
> As Kavita talks about Git Bash, it is probably Git for Windows, for
> which /bin should not be in the PATH but /mingw64/bin or /mingw32/bin
> (depending on the architecture).

I did check this with my Git for Windows installation before posting. Mine is older (2.7.0) though so maybe things have changed:

  pds@build-win MINGW64 ~
  $ type -a ls
  ls is aliased to `ls -F --color=auto --show-control-chars'
  ls is /usr/bin/ls
  ls is /bin/ls
  ls is /usr/bin/ls
  ls is /usr/bin/ls
Clearly I have a lot of duplicates on my PATH now that I notice :)

I have /mingw64/bin on my PATH as well but looking there it has git, gettext, edit, a bunch of DLL's, etc. but it doesn't contain ls or other coreutils programs.

Cheers!
Johannes Schindelin· Jul 14, 2017, 21:52 UTC · re: Paul Smith · lore

Re: Git Bash Bug

Hi Paul,
On Fri, 14 Jul 2017, Paul Smith wrote:
Show 17 quoted lines
> On Fri, 2017-07-14 at 22:33 +0200, Johannes Schindelin wrote:
> > > You absolutely have to have /bin and /usr/bin on your PATH,
> > 
> > As Kavita talks about Git Bash, it is probably Git for Windows, for
> > which /bin should not be in the PATH but /mingw64/bin or /mingw32/bin
> > (depending on the architecture).
> 
> I did check this with my Git for Windows installation before posting. 
> Mine is older (2.7.0) though so maybe things have changed:
> 
>   pds@build-win MINGW64 ~
>   $ type -a ls
>   ls is aliased to `ls -F --color=auto --show-control-chars'
>   ls is /usr/bin/ls
>   ls is /bin/ls
>   ls is /usr/bin/ls
>   ls is /usr/bin/ls
Oh wow ;-)

For the record, /bin/ is simply mapped to /usr/bin/. They are not different directories, really.

> Clearly I have a lot of duplicates on my PATH now that I notice :)
;-)
> I have /mingw64/bin on my PATH as well but looking there it has git,
> gettext, edit, a bunch of DLL's, etc. but it doesn't contain ls or
> other coreutils programs.

Right. The difference between executables in /mingw64/bin/ and in /usr/bin/ is that the latter executables all implicitly link to msys-2.0.dll, i.e. the POSIX emulation layer based on Cygwin. As you probably guessed: the coreutils are all compiled using that POSIX emulation layer.

Ciao, Johannes

← back to recent threads