How to install Git for Cygwin?

In the world of Cygwin, there is really no such thing as only installing a package AS you are installing Cygwin. Cygwin was inherently designed with a setup.exe to be run multiple times when necessary.

There are thousands of packages available in the Cygwin repo mirrors. From what you are saying, it sounds as if you had a single go-round with the setup file and then planned to never install any additional available packages or upgrade them in the future. This is what the Cygwin setup file is specifically used for.

If you don’t currently have Git installed in your particular Cygwin environment, just run setup.exe again and select the package. It should automatically detect your current installation directory and package directory and previously-selected mirror. When you mark the Git package for installation, it will automatically download all dependencies, just like apt-get or any other *NIX package manager.

There is also an abandoned project called apt-cyg that I still use religiously, especially on remote systems over SSH in order to avoid the GUI setup.exe. apt-cyg is basically a shell script that will install your package directly from the command line, apt-get-style. It requires wget and subversion, but after the 30 seconds it takes to setup, you’d just run apt-cyg install git. It also installs dependencies, just like the GUI setup.exe.

There is also a similar alternative if you install Cygwin via Chocolatey package manager — you can also install cyg-get (I believe it’s called). The syntax is a bit different — something like cyg-get git. I don’t really like this method, because it differs from apt-cyg in the fact that it actually uses the setup.exe and just automates the process so that you don’t have to click anything. I don’t use this method, because the last I checked, Chocolatey only supported 32-bit Cygwin installs, which is also what the cyg-get package looks for.

apt-cyg may be abandoned, but it has yet to disappoint, and if I know what I’m looking for, I always prefer it over running the setup.exe for package installation.

It looks like the project has been picked back up and is under active development again: https://github.com/transcode-open/apt-cyg

It appears this version requires lynx to install. I don’t know. I still just use the original version on Google Code that worked just fine the last I checked: https://code.google.com/p/apt-cyg/

Edit: There has been a new Cygwin package manager out for awhile called cyg-get that can be installed via Chocolatey. I’m not sure if it only works for Chocolatey-installed Cygwin installations or not, as Chocolatey doesn’t install Cygwin in the normal locations anymore by default. Feel free to comment, but cyg-get is now my Cygwin package manager of choice unless I’m running an older installation of Cygwin that was not installed by Chocolatey. I avoided it for a while because they only supported 32-bit installations, but I can confirm that Chocolatey now supports 64-bit installations of Cygwin, and the cyg-get package manager works perfectly with it. I have a function sourced from my ~/.bashrc where I can use either apt or apt-get (with or without the install parameter, and it will just call cyg-get.bat with the programs I have specified to install.

Leave a Comment