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?

Aleksander Blomskøld
  • 18,374
  • 9
  • 76
  • 82
mnaoumov
  • 2,146
  • 2
  • 22
  • 31
  • Cygwin now provides [git-2.1.1-1](https://cygwin.com/cgi-bin2/package-cat.cgi?file=x86%2Fgit%2Fgit-2.1.1-1&grep=git) – idbrii Nov 21 '14 at 20:26

8 Answers8

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.
RedX
  • 14,749
  • 1
  • 53
  • 76
  • 1
    +1: yup, cygwin does have git v1.8.3.4 (so no need to clone and build git from source). – rsenna Nov 21 '13 at 03: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 03 '14 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 '20 at 01: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.

William Seiti Mizuta
  • 7,669
  • 3
  • 31
  • 23
  • 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 09 '13 at 16:05
  • 1
    Small missing step... first: `make configure` to create the `./configure` file. – darcyparker May 10 '13 at 21:59
  • Also, I had to run 'make -i install' instead of 'make install' because of [a problem related to gettext](http://stackoverflow.com/questions/9500898/compiler-error-msgfmt-command-not-found-when-compiling-git-on-a-shared-hosting) – Conan Jun 26 '13 at 13:07
  • There are some problems running 'make'. Try 'make -i' and then 'make -i install' - it should work. – tom.bujok Aug 13 '13 at 07:21
  • 1
    See my answer at the bottom for a compilation free way. – RedX Nov 21 '13 at 08:35
  • See my answer for anyone encountering `Permission denied` during the `make install` step – M.M May 22 '14 at 00:01
  • Also consider running `make test` before `make install`, although it takes a long time to run. – M.M May 22 '14 at 00:02
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
    
Achal Dave
  • 4,079
  • 3
  • 26
  • 32
Azif
  • 73
  • 1
  • 4
  • Note that [link-only answers are discouraged](http://meta.stackoverflow.com/tags/link-only-answers/info), 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 '13 at 08:27
  • 1
    "gcc-core" appeared to be the package I needed here, installed a bunch of required dependencies too. – Gavin Gilmour May 19 '14 at 06: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

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

Yorkwar
  • 1,204
  • 1
  • 11
  • 27
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.

M.M
  • 138,810
  • 21
  • 208
  • 365
  • 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 '15 at 02: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 '15 at 02: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 '15 at 04: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.

Zombo
  • 1
  • 62
  • 391
  • 407
-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.

Gerrit Brouwer
  • 732
  • 1
  • 6
  • 14
  • -1 He wants to install git @cygwin – road242 May 21 '14 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 '14 at 00: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). – Gerrit Brouwer May 22 '14 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 06 '14 at 07:15
  • Yes! Release 2.1.0 is now available in the standard cygwin distro: git --version shows "git version 2.1.0" :-) – Gerrit Brouwer Sep 08 '14 at 11:29
  • This solution answers the question at least partially. Please don't down vote if question wasn't asked properly grammatically or stylistically – Nikolay Frick Mar 12 '15 at 15:38