Git Installation Leaves Me Confused
So I finally decided to give Git a go. I work on Windows XP. Git's homepage lists msysgit as the installer for non-Cygwin Win32 users, so I went on and grabbed it. The installation, however, proved far less straightforward than I expected.
First, msysgit presented me with the following screen:
I have three choices:
Use Git Bash only. I am a newbie Git user. I am just starting to use Git. I have read some basic tutorials that assume the user is running a unix machine, but do not really know yet what the preferred Git interface on Win32 is. I do not know what "Git Bash" is. Maybe it is a modified version of Bash that is designed to provide a better interface to Git? May be it is the nickname of an important Git tool that is known to everybody else but me? Do I want to use that? Will this Git Bash thing still be installed if I select any of the other options? I have no idea.
Run Git from the Windows Command Prompt. This "heading" sounds OK - from the tutorials I have read I assumed that I will be using Git from the command line, so that sounds as what I would need to use. But then the text says: "Use this option if you want to use Git from a Cygwin Prompt". Well, I don't use Cygwin so is this still a good option for me? Is this a general purpose option or is it an option specifically targeted for Cygwin users? It initially looked to me that this is the most appropriate option for the average Joe user (not too conservative and not too dangerous), but it is not selected by default so maybe it is not? And should Cygwin be mentioned here at all when there was a separate download link for Cygwin on the Git home page.
Run Git and included Unix tools from the Windows Command Prompt. This option scares me right away. What are these "accompanying Unix tools"? Where can I get a list of them and why is this thing trying to install them when I only want to use Git?
So, faced with a choice between this conservative Git Bash option, the option for the Cygwin Prompt and the "accompanying Unix tools" option, I realise I have no absolutely no clue which one to choose. So I head to the msysgit website to find some info. Nothing on the start page. Nothing on the InstallMSysGit page. I check the list of wiki pages but no page description seems to point at the information I need.
So I look at the screen again, and finally decide that the second option probably means "Use from the Windows Command Prompt OR the Cygwin Prompt", so I am going to take a chance and give it a try.
Then comes the second screen:
I have no idea what the difference is between ssh.exe and plink.exe and why I would choose one over the other. A brief search on the msysgit homepage fails to enlighten me either. I choose, for no particular reason whatsoever, to stick with the option that is selected by default (OpenSSH).
And just when I thought I was done, there came screen number three:
I work on Win32 and most of the files I create have Windows-style line endings. But I occasionally hack on some open source projects where line endings tend to be Unix-style. But why would Git care about that? SVN never asked me such as question! It seems the most reasonable option for me would be the third one ("Commit line endings as they are") but why is this question asked at all? What is are the consequences of this choice? Does Git do something special with line endings that do not match my choice (e.g. if I choose Windows-style and then try to upload a file with Unix-style line endings, will Git attempt to convert the line-endings to Windows-style automatically?) Or maybe some git commands do not work properly unless they know the type of line endings in advance? Again, the msysgit website fails to give me any information.
Post-installation, I looked at what Git had installed, did some research and found the following:
Screen #1: msysgit is apparently based on the "MSYS" tools provided by the MinGW project, so it ships these tools with its installation file. It is hard to figure what these tools are before install, since they seem not to be listed even on the MYSYS website itself. Msysgit creates a directory (called "bin"), where it places these tools (i.e. the .dll and .exe files), along with the actual git commands. It also creates a second directory(called "cmd"), where only links to the git tools ("git" and "gitk") are created. Armed with this knowledge, we can figure out what the individual choices from the first screen entail:
Use Git Bash only. The MSYS tools contain a port of Bash. If you select this option, msysgit will add to your "Start" menu a link to the Bash executable. It will launch a command prompt window with Bash, and since it will open in the directory where all the other the MSYS tools are located ("bin"), you will be able to invoke the git commands from there. Neither the "bin" nor the "cmd" directories will be added to your PATH, so you will not be able to use the "git" command from an ordinary command prompt window.
Run Git from the Windows Command Prompt. This is probably the preferred option for most users. The link to Bash will be added as above, but in addition the "cmd" folder will be added to your PATH environment variable, so that you can use the "git" command from anywhere - the standard Windows Command Prompt, a Cygwin prompt, or any other shell that you may be using.
Run Git and included Unix tools from the Windows Command Prompt. The "bin" directory will be added to your PATH, so in addition to "git", the other MSYS commands will also be made available anywhere in your system. This may not be the best idea - some of the MSYS tools may conflict with the built-in Windows tools, and in particular MSYS ships its own "perl.exe" which may mess up with your default perl installation.
Screen #2: While browsing the support forum on Github, I read about a number of issues resulting from the use of Git with plink.exe, so you are probably better off sticking with OpenSSH here.
Screen #3: This option apparently modifies a setting in Git ("core.autocrlf") that controls whether Git would automatically convert line endings to a single format when pulling and committing code. This can be helpful if you want to make sure that all files in a repository use the same line-ending style, but may be a problem if you are working with multiple repositories and in heterogeneous environments (I have yet to find how to set this option on a per-repository basis).
Despite this rant, I have to express my gratitude to the msysgit people for porting git to Win32 in the first place. I am now a (mostly) happy git user, and there are already some things about git that I seem to like very much (I will probably write an article about that soon). I hope that this explanation will help some people who, like me, were used to the ease of use of Subversion and TortoiseSVN on Win32, and felt a little intimidated while installing Git. Or maybe it was just me ...