32

I have started using Cygwin recently for other purposes and already have Git installed on my PC. I understand I can run the executable and install Git into Cygwin, but since I already have it installed I would like Cygwin to just use my Windows installation. I have tried researching how to make the path redirect in various ways but with no success, can someone help me out?

Zombo
  • 1
  • 62
  • 391
  • 407
jh_
  • 411
  • 2
  • 5
  • 9
  • From personal experience, I know it's actually possible to use the msysgit version of Git in Cygwin. I don't remember how off the top of my head, but I'll try to set it up and add it as an answer later. –  Aug 12 '13 at 04:33
  • @Cupcake: I'd sure love to know how. I've spent all afternoon trying every possible permutation of setup to make that work. Cygwin's git doesn't work across network shares. Msysgit works across shares fine, but I haven't been able to make it work with Cygwin. – nerdfever.com Dec 04 '14 at 03:41
  • This appears to be a duplicate of [Git: Command not found Windows](http://superuser.com/q/568964) on Super User. – jww Jun 30 '15 at 21:59

3 Answers3

55

I confirm that git and msysgit can coexist on the same computer, as mentioned in "Which GIT version to use cygwin or msysGit or both?".

  1. Git for Windows (msysgit) will run in its own shell (dos with git-cmd.bat or bash with Git Bash.vbs)
    Update 2016: msysgit is obsolete, and the new Git for Windows now uses msys2

  2. Git on Cygwin, after installing its package, will run in its own cygwin bash shell.

git package selection on Cygwin

  1. Finally, since Q3 2016 and the "Windows 10 anniversary update", you can use Git in a bash (an actual Ubuntu(!) bash).

http://www.omgubuntu.co.uk/wp-content/uploads/2016/08/bash-1.jpg

In there, you can do a sudo apt-get install git-core and start using git on project-sources present either on the WSL container's "native" file-system (see below), or in the hosting Windows's file-system through the /mnt/c/..., /mnt/d/... directory hierarchies.

Specifically for the Bash on Windows or WSL (Windows Subsystem for Linux):

  • It is a light-weight virtualization container (technically, a "Drawbridge" pico-process,
  • hosting an unmodified "headless" Linux distribution (i.e. Ubuntu minus the kernel),
  • which can execute terminal-based commands (and even X-server client apps if an X-server for Windows is installed),
  • with emulated access to the Windows file-system (meaning that, apart from reduced performance, encodings for files in DrvFs emulated file-system may not behave the same as files on the native VolFs file-system).
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Alas, Cygwin's git has problems with Windows network shares. Mysysgit doesn't have that problem. – nerdfever.com Dec 04 '14 at 03:40
  • @nerdfever It does? It certainly has [this problem](https://groups.google.com/forum/#!topic/msysgit/5J3ELvZND0s), but so does msysGit. (I for one use msysGit mostly because cygwin git is comparably slow) – tjollans May 25 '16 at 08:34
4

Isn't this as simple as adding your git install to your Windows path?

E.g. Win+R rundll32.exe sysdm.cpl,EditEnvironmentVariables Edit...PATH appending your Mysysgit install path e.g. ;C:\Program Files (x86)\Git\bin. Re-run Cygwin and voila. As Cygwin automatically loads in the Windows environment, so too will your native install of Git.

Jonathan
  • 10,936
  • 8
  • 64
  • 79
0

call your (windows-)git with cygpath as parameter, in order to convert the "calling path". I m confused why that should be a problem.

inselberg
  • 549
  • 3
  • 13
  • 27