41

According to http://cygwin.com/packages/git/ the latest available Cygwin package is 1.7.9-1.

I would like to update git to at least 1.8.0.

Can I do this?

1

8 Answers 8

46

cygwinports has many new versions of various tools

At the time i write this it has 1.8.3.4

New, simplified installation instructions:

  • Use the latest Cygwin installers (at least version 2.829): setup-x86.exe for 32-bit, or setup-x86_64.exe for 64-bit. (Note that many packages have not yet been ported to x86_64.)
  • Launch setup-*.exe with the -K flag, e.g.:

    cygstart -- /path/to/setup-x86.exe -K http://cygwinports.org/ports.gpg

  • On Choose Installation Type page, select "Install from Internet".

  • On Choose Download Site(s) page, select a distro mirror, then enter ftp://ftp.cygwinports.org/pub/cygwinports in the User URL field and press Add (making sure that both are highlighted).
    1. Alternatively, you can use a sourceware mirror, but if you do, you must use one hosted on a different server than your selected distro mirror.
  • Proceed with package selection and installation, making sure to install any indicated dependencies.
3
  • 1
    +1: yup, cygwin does have git v1.8.3.4 (so no need to clone and build git from source).
    – rsenna
    Nov 21, 2013 at 3:42
  • 4
    To avoid getting more than you bargained for, click the "View" button in setup's "Select Packages" step. Setup defaults to updating everything for which your selected sites (e.g. CygwinPorts) have updates, and newer isn't always better.
    – Pete
    Mar 3, 2014 at 22:47
  • I get an error message: "550 /pub/cygwinports/x86_64/setup.xz.sig: No such file or directory" (I want to use git 2.22 but Cygwin only has 2.21.)
    – RyanCu
    Jan 22, 2020 at 1:54
29

To install git 1.8.0 you need to compile the source code.

You need to clone the git repository (git clone https://github.com/git/git.git), enter the git directory, change the current version to 1.8.0 or other version that you want (git checkout v.1.8.0) and type the following commands:

make configure
./configure --prefix=/usr/local
make
make install

It will install git under /usr/local directory. For more information about git installation, like documentation, you can take a look in INSTALL file localized in git repository root.

7
  • If you run into problems, try updating your Cygwin installation (ie, run the Cygwin setup.exe again). I had some issues with Git 1.8.1 building because some of my libs were behind locally. You can check your Cygwin version with "uname -r".
    – kenchilada
    Apr 9, 2013 at 16:05
  • 1
    Small missing step... first: make configure to create the ./configure file. May 10, 2013 at 21:59
  • Also, I had to run 'make -i install' instead of 'make install' because of a problem related to gettext
    – Conan
    Jun 26, 2013 at 13:07
  • There are some problems running 'make'. Try 'make -i' and then 'make -i install' - it should work.
    – tom.bujok
    Aug 13, 2013 at 7:21
  • 1
    See my answer at the bottom for a compilation free way.
    – RedX
    Nov 21, 2013 at 8:35
7

I successfully installed git 1.8.4.474 by following these instructions; I'm running Windows 7 64 bits, cygwin version 1.7.22(0.268/5/3)

  1. Run the Cygwin setup utility and ensure you have the following packages installed:

    gcc
    autoconf
    curl
    libcurl-devel, required for http/https support 
                   (NOTE: this is an obsolete package, you will need to
                   uncheck "Hide obsolete packages" when selecting packages
                   to install)
    make
    libiconv
    python
    perl
    gettext
    

    You may need libiconv-devel and cygwin32-liviconv (see Marek's comment)

  2. Clone the Git sources with git clone https://github.com/git/git.git. A couple of notes on that with respect to Git configuration:

    Make sure core.autocrlf=false, otherwise you'll end up with DOS style line endings that cause the build to break.

    I also had a screwy http.sslcainfo property value; either unset it or point it to /usr/ssl/certs/ca-bundle.crt.

  3. From your newly cloned git repo, run the following commands:

    make configure
    ./configure
    make
    make install
    
2
  • Note that link-only answers are discouraged, SO answers should be the end-point of a search for a solution (vs. yet another stopover of references, which tend to get stale over time). Please consider adding a stand-alone synopsis here, keeping the link as a reference.
    – kleopatra
    Oct 13, 2013 at 8:27
  • 1
    "gcc-core" appeared to be the package I needed here, installed a bunch of required dependencies too. May 19, 2014 at 6:36
3

You're instructions didn't really work for me...

I followed these instructions (as far as making sure all the correct packages are installed)

http://randomartifacts.blogspot.com/2013/04/compiling-git-on-cygwin.html

Modified the Makefile

$ git diff Makefile
diff --git a/Makefile b/Makefile
index 3588ca1..90f337c 100644
--- a/Makefile
+++ b/Makefile
@@ -407,7 +407,7 @@ RPMBUILD = rpmbuild
 TCL_PATH = tclsh
 TCLTK_PATH = wish
 XGETTEXT = xgettext
-MSGFMT = msgfmt
+MSGFMT = msgfmt.py
 PTHREAD_LIBS = -lpthread
 PTHREAD_CFLAGS =
 GCOV = gcov

then

make configure NO_MSGFMT_EXTENDED_OPTIONS=1
./configure
make NO_MSGFMT_EXTENDED_OPTIONS=1
make install NO_MSGFMT_EXTENDED_OPTIONS=1

Not sure if the param is needed for all the make commands, but this worked for me

1
  • With 64bit version had install gcc-core (bc gcc wouldn't work). Sep 4, 2013 at 1:40
2

I got problem when doing "make install". The error message is:

install -d -m 755 '/usr/local/bin'
git: 'installation' is not a git command. See 'git --help'.
./install: line 4: Normally: command not found
./install: line 5: will: command not found
./install: line 6: to: command not found
./install: line 8: $: command not found
./install: line 11: syntax error near unexpected token .'
./install: line 11:
(or prefix=/usr/local, of course). Just like any program suite'

This is due to the case insensitivity of Windows OS if you have "./" in your PATH. Cygwin use the INSTALL file in the git source tree instead of /usr/bin/install. We have to rename some "INSTALL" files in the source tree to other file name. This is mentioned by http://zengrong.net/post/1817.htm

1

I had a problem doing this that took me an hour to debug, so am posting an answer in case anyone else comes here looking.

Actually it is the same cause as Yorkwar's, but different errors.

Everything goes fine until make install outputs:

$ make install
    GEN perl/PM.stamp
    SUBDIR gitweb
    SUBDIR ../
make[2]: 'GIT-VERSION-FILE' is up to date.
    GEN git-instaweb
    BUILTIN all
    SUBDIR git-gui
    SUBDIR gitk-git
    SUBDIR perl
    SUBDIR templates
install -d -m 755 '/usr/local/bin'
make: execvp: install: Permission denied
Makefile:2342: recipe for target 'install' failed
make: *** [install] Error 127

After a lot of mucking with UAC, setuid, icacls, ownership etc. , I found via strace that the actual problem is that when executing install: since I have ./ in my PATH, and Windows is case-insensitive, it tries to execute INSTALL, which is a textfile that does not have the x bit set. So the "Permission denied" refers to the fact that x is not set on this file.

@Yorkwar fixed this by renaming all the INSTALL files, however another option is to edit Makefile and replace

INSTALL = install

with

INSTALL = /usr/bin/install

I'm using cygwin 32-bit in Windows 7 64-bit (installed it before cygwin64 came out and haven't bothered to upgrade). Successfully built and install git version 2.0.0.rc4.dirty which was the result of git clone https://github.com/git/git.git.

3
  • I just opened an instance of bash as administrator, then ran the make install command. Worked like a charm, and I didn't have to modify any of the files.
    – nihilon
    Apr 21, 2015 at 2:28
  • @nihilon why did you post that. my answer is aimed at those who had the same problem as me , not at random people who had no problems
    – M.M
    Apr 21, 2015 at 2:51
  • Because I ran into the same error and solved it without needing to modify the makefile, or do much of anything else? Perhaps, maybe? Of course, there is always potato. As for the being 'aimed...at random people who had no problems' part, I am not really sure what that has to do with anything. I commented on your answer, aimed at people with a specific problem. Not to random people with no problems. I felt I had solved the same issue with fewer steps, and less file modifying, so I mentioned it. See what I did there?
    – nihilon
    Apr 22, 2015 at 4:11
0

A pre built package is not available, so you would have to build it yourself.

Alternatively you could download a non Cygwin build and just add it to your PATH.

-1

You can install the latest version for the Windows platform from git-scm.com/download/win.

Add the following to your ~/.profile:

export PATH=$PATH:`cygpath 'C:\Program Files (x86)\Git\bin'`

I use this git client from both SourceTree and cygwin in combination with a Gerrit/SSH server and did not run into any problem yet.

6
  • -1 He wants to install git @cygwin
    – road242
    May 21, 2014 at 11:09
  • The binary version from that site doesn't know about Cygwin paths, so strange things happen if you try to use it under Cygwin.
    – M.M
    May 22, 2014 at 0:04
  • Which strange things do you mean? I did not run into any problem yet. I tried the git client from the cygwin distro but this one showed strange behavior when pushing to a git/ssh server (hangs forever). May 22, 2014 at 12:24
  • The version at git-scm.com is also usually behind the available sources. At the moment of this writing, git-scm.com offers Git version 1.9.4, while the source code is already at version 2.1.0-rc2.
    – Manuzor
    Sep 6, 2014 at 7:15
  • Yes! Release 2.1.0 is now available in the standard cygwin distro: git --version shows "git version 2.1.0" :-) Sep 8, 2014 at 11:29

Not the answer you're looking for? Browse other questions tagged or ask your own question.