Labels

APPLE (1) astro (1) IDL (4) life (2) linux (5) LSD (2) Mac (2) teaching (1) volleyball (2) work (1)

Saturday, February 14, 2015

How to build the newest version of Git for Windows?

The previous post talked about how to make makefile work on Git Bash for Windows. This Git Bash comes with the current downloadable executable from the official Git website. At the time of writing, the Git and Msysgit version from this downloadable executable is both on version 1.9.5.

I checked out the official Git website again the other day and found out that the newest Git version is 2.3.0. As someone who always want to be experiencing the newest technologies, I, of course would like to install this newest version on my computer. Just kidding. In fact I went back to the website because the Git Bash at the time was having problems handling unicodes when running PostgresQL and IPython from the command line. It messes up the command line structure and I had to run "clear" to take it back to normal. However I can't do it when I am inside IPython. Therefore, I was looking for a newer version of Git Bash that handles unicode well.

The newest version Git (along with Git Bash) is supposed to be able to do the job. The source code is right there on github, but I did not have any knowledge about building Git from source. After some digging on the internet, I went back to the origin, the same repo on the source code, knowing that I can build the newest version of Git for Windows from msysgit. Here is a step by step tutorial on how to build the newest version of Git for Windows.

This tutorial benefits mostly from the wiki of the Github repo.
1. Download netinstaller for msysgit;
2. Click on the installer and select a directory (I used the default: "C:\msysgit\") and let it run.
That's it.

You might wonder why the hell do I need this tutorial then since this is so straightforward. The reason is that actually you might encounter failure as I did.
The error messages I got is:

Generating catalog po/bg.msg
msgfmt --statistics --tcl po/bg.po -l bg -d po/w 304 .
make[1]: *** [po/bg.msg] Error 1
make: *** [all] Error 2

-------------------------

Hello, dear Git developer.

This is a minimal MSYS environment to work on Git.

Your build failed... Please fix it, and give feedback on the Gitlist.

Welcome to msysGit
Run 'git help git' to display the help index.

Run 'git help ' to display help for specific commands.
Run '/share/msysGit/add-shortcut.tcl' to add a shortcut to msys
Git.bash: /git/contrib/completion/git-completion.bash: 
No such file ordirectorybash: __git_ps1: command not found


If you unfortunately encountered this problem, the trick is as follows:
(useful link: https://groups.google.com/forum/#!msg/msysgit/TNXXQ21mfrg/IGkW5ZNoLYgJ )
1. exit msysgit by typing "exit" after the failure;
2. find the file  /share/msysgit/net/setup-msysgit.sh, open it in a text editor and add the following line to the beginning of the file:
export LANG='C';
3. click on msys.bat in the C:\msysgit\ folder and it opens a command line window;
4. type in cd git in the command line;
5. type in make clear in the command line;
6. type in make install in the command line.

Now you should be good to go. 


No comments: