Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

msysgit bash shell- how to troubleshoot "cannot find command"

Tags:

git

msysgit

I need help getting git extensions to run with msysgit. I have had bad luck with extensions git-tfs and git-fetchall, in both cases it is the same problem. The addon will require a file to be placed where git can find it (git-tfs.exe and git-fetchall.sh). I understand this to mean the files need to be in a directory that is in the 'PATH' environment variable. In both cases I get stuck at this point:

$ git-diffall
bash: git-diffall: command not found

or:

$ git-tfs
bash: git-tfs: command not found

When I run echo %PATH% from a regular command shell, it shows my path variable includes the directories where git-diffall and git-tfs are. How can I debug this, or am I missing something? Is there a way within msysgit to verify the command search path is what I expect?

like image 829
Frank Schwieterman Avatar asked Jul 28 '26 18:07

Frank Schwieterman


2 Answers

Ok, I found the disconnect. It was elusive until I started running "echo $PATH" from the shell (rather then echo %PATH% from the windows command shell, which had a different result).

Two problems:

  1. When I configured the environment variables, I originally had a '\' at the end of the path. This seemed to caused echo $PATH to show invalid pathnames like '/c:/directory' instead of '/c/directory/.

  2. A reboot was necessary for changes to the system environment variables made through the windows UI to be reflected in the msysgit/bash/git shell.

like image 121
Frank Schwieterman Avatar answered Jul 30 '26 09:07

Frank Schwieterman


In addition to being in the $PATH, they also need to be executable. So, in Cygwin (I'm asssuming Windows because you used "%PATH%" instead of "$PATH" in your question, which is a Windows-specific thing), you should navigate to the directory in which the program git-difall is located, and then type:

chmod a+x git-diffall

Also, unlike Windows which ignores the ".exe", ".com", ".bat", etc. extensions, BASH does care about these extensions, so if you have git-diffall.sh on your path, you would need to invoke it as git-diffall.sh and not as git-diffall. If you want to invoke it as git-diffall, then simply remove the file extension. You can do this using the Cygwin commandline as well, using:

mv git-diffall.sh git-diffall

Also, the first chmod needs to use git-diffall or git-diffall.sh depending on the actual name.

like image 34
Michael Aaron Safyan Avatar answered Jul 30 '26 08:07

Michael Aaron Safyan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!