6

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.

Community
  • 1
  • 1
Daniel Kaplan
  • 62,768
  • 50
  • 234
  • 356
  • possible duplicate of [How to get Git 1.8 in Cygwin?](http://stackoverflow.com/questions/14330050/how-to-get-git-1-8-in-cygwin) – idbrii Nov 21 '14 at 19:59
  • Dupe of http://stackoverflow.com/q/14330050/79125 (which is out of date -- probably better to give it an update answer and edit the title than to create a new question) – idbrii Nov 21 '14 at 20:00

2 Answers2

6

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.

Daniel Kaplan
  • 62,768
  • 50
  • 234
  • 356
  • Hmm, when I did it there were no changes after converting dos2unix, so that step is probably not needed. – jmh Jan 13 '14 at 23:57
  • I needed libiconv-devel as well. Not sure if libiconv is required. – jmh Jan 13 '14 at 23:59
  • I also needed to follow instructions here: http://stackoverflow.com/questions/14330050/how-to-get-git-1-8-in-cygwin/18604066#18604066 due to a problem with the version of msgfmt that cygwin comes with. – jmh Jan 14 '14 at 00:04
  • @jmh odd, I definitely didn't have to do the steps linked in that answer. Re: libiconv-devel, I'll take your word for it. This was about an hour of trial and error so I may have missed that. I'm going to leave libiconv in just in case. – Daniel Kaplan Jan 14 '14 at 00:06
  • Well I am on windows 7 64 bit. Maybe that makes a difference. – jmh Jan 15 '14 at 18:12
  • 1
    I assume the need of dos2unix or not dependes on the setting `git config core.autocrlf`. If it is true, you need to convert the line endings (back) to unix. – johnny Oct 06 '16 at 06:53
  • 1
    There have been some changes since this was posted. `openssl-devel` is now `libssl-devel`, and `expat-devel` is `libexpat-devel`. – Keith Thompson Nov 01 '19 at 06:24
1

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