Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I build and use the latest version of git on cygwin?

Tags:

git

cygwin

As for why I'd want to do this, see this question: What are the downsides to using the official Windows Git binaries from cygwin?

Or you could look at this: http://git.661346.n2.nabble.com/Fwd-Error-with-git-svn-pushing-a-rename-td7599382.html It prevents you from pushing renamed files to the svn server.

Cygwin is stuck at a version of git that has numerous bugs when used with the git-svn bridge. A lot of these have been fixed in the latest git (their master branch, not the one available for download). So how do you get, build and use it?

I'll answer this below.

like image 923
Daniel Kaplan Avatar asked Jan 10 '14 20:01

Daniel Kaplan


2 Answers

To compile git, you're going to need to install a few required packages. I'm going to assume you know how to install things on cygwin by using their setup.exe. Here's what you need to install:

git (you need git to get git source)
make
gcc-core
libcurl-devel
openssl-devel
subversion-perl
dos2unix
libiconv
libiconv-devel
gettext
expat
gettext-devel
expat-devel

Here's how you get the source:

git clone https://kernel.googlesource.com/pub/scm/git/git.git
cd git

Now for some reason I don't understand, I have to convert all the files to have unix line endings. I don't understand why they didn't already come that way. I did that with this:

find . -type f | xargs dos2unix

Finally I did these steps:

  make -j8
  make test; # optional, to verify that the git you built works ok
  export PATH=$(pwd)/bin-wrappers:$PATH

The git binaries are in ./bin-wrappers. You probably want to permanently add that directory to your path.

like image 125
Daniel Kaplan Avatar answered Oct 30 '22 10:10

Daniel Kaplan


Also needed to add zlib-devel at least for git 2.25

like image 42
Frank Bresz Avatar answered Oct 30 '22 10:10

Frank Bresz