6

I installed Git-Bash but I won't be able to access all the tools(vim,vimdiff) that I can access with Cygwin. Can that be set in one of the Git config files?

user2066671
  • 157
  • 1
  • 15

3 Answers3

3

Git bash, and related tools in msysgit package, are pure Windows executables.

That's why you cannot run Cygwin tools into Git bash, since these are not completely windows programs (they need the cygwin.dll, see @fvu comment below).

If you want to use Git with Cygwin tools, you have to install the git package for Cygwin.

Guillaume Darmont
  • 4,702
  • 1
  • 19
  • 34
  • Cygwin-compiled programs are Windows programs, but they depend on an emulation of certain POSIX features as provided by the cygwin dll. More info [here](http://stackoverflow.com/questions/771756/what-is-the-difference-between-cygwin-and-mingw). But that doesn't change your conclusion. – fvu Jul 01 '13 at 21:48
  • 1
    Then why is it possible to run Cygwin tools from cmd.exe (which is a pure Windows executable), but not Git bash? – Claus Conrad Jan 23 '15 at 17:09
  • Then why is it possible to run Cygwin `rsync` from Git Bash, after I added `C:\cygwin64\bin` to the `PATH` environment variable? See answer below by Keith Tyler. – Amedee Van Gasse May 27 '19 at 13:51
3

You might just need to add the cygwin bin directory to your $PATH variable in git bash.

Despite what everyone else seems to think they know, Git Bash is actually pretty much repackaged Cygwin. Viz: https://github.com/msysgit/msys/tree/master/winsup/cygwin

Keith Tyler
  • 662
  • 3
  • 14
0

If you add theCygwin bin directory to your $PATH variable in git bash, make sure to use Git 2.27 (Q2 2020).

Utilities run via the run_command() API were not spawned correctly on Cygwin, when the paths to them are given as a full path with backslashes.

See commit 05ac858 (27 Mar 2020) by Andras Kucsma (r0mai).
(Merged by Junio C Hamano -- gitster -- in commit d01b722, 22 Apr 2020)

run-command: trigger PATH lookup properly on Cygwin

Signed-off-by: Andras Kucsma

On Cygwin, the codepath for POSIX-like systems is taken in run-command.c::start_command(). The prepare_cmd() helper function is called to decide if the command needs to be looked up in the PATH. The logic there is to do the PATH-lookup if and only if it does not have any slash '/' in it. If this test passes we end up attempting to run the command by appending the string after each colon-separated component of PATH.

The Cygwin environment supports both Windows and POSIX style paths, so both forwardslahes '/' and back slashes '\' can be used as directory separators for any external program the user supplies.

Examples for path strings which are being incorrectly searched for in the PATH instead of being executed as is:

"C:\Program Files\some-program.exe" - "a\b\c.exe"

To handle these, the PATH lookup detection logic in prepare_cmd() is taught to know about this Cygwin quirk, by introducing has_dir_sep(path) helper function to abstract away the difference between true POSIX and Cygwin systems.

VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283