Getting Git to Windows

In my opinion, the best option for former (or concurent) SVN users is to install TortoiseGit. It mimics nearly everything, you had in TortoiseSVN into Git world. Note, that on official TortoiseGit site you're recommended to install TortoiseGit first, then msysgit. This is conviniend, if you're Git-only user (details below). If you also use TortoiseSVN, consider installing msysgit first.

Before you start

Both msysgit and TortoiseGit were in 1.8.3 version, as of writing this article (end of June 2013), but users were recommended to not use msysgit 1.8.3 with TortoiseGit 1.8.3, as there are known issues. Using msysgit 1.8.1.2 with TortoiseGit 1.8.3 (if new, clean install) or wating for TortoiseGit 1.8.4 with msysgit 1.8.3 (upgrade) were recommended options.

Unlike TortoiseSVN, TortoiseGit doesn't have any git client on-board, so you have to manually install it before. The best choose here seems to be msysgit -- The official Git for Windows. You can grab it from here.

Installation of Git for Windows

There are three configuration screens in Git for Windows installer, that might get new users a little bit confused. Here are my suggestions:

1. On first screen, where you choose, how you would like to access git command-line client (Adjusting your PATH environment), you should select second option (Use Git from the Windows Command Prompt). Default (first) option (Use Git bash only) forces you to use only bash version, which is less comfortable in my opinion. Selecting second option will give you access to git client from Windows command-line, within any path or folder. Convenient and simpler for Windows users.

2. If you have TortoiseSVN (or Putty) installed on your computer, you can tell msysgit's installer to use TortoisePlink instead of build-in SSH client, on second screen (Choosing the SSH executable). Path to it should be discovered automatically by installer. If not, use C:\Program Files\TortoiseSVN\bin\TortoisePlink.exe or something around. Plink is said to be working more stable on Windows. If don't have neiter TortoiseSVN or Putty, consider installing TortoiseGit before msysgit. It will not work without it, but it also ships with TortoisePlink, so you can select it, when installing msysgit.

3. Third screen (Configuring the line ending conversion) lets you decide, which line endings (Windows, Linux or mixed) will be used when checking out and committing files. Default option (Checkout Windows-style, commit Unix-style line endings) seems to be the best choice. Difference comes from the fact, that most Git servers is using Linux operating system (and this -- Linux-like line endings for files), while TortoiseGit is Windows program, and so, uses Windows-like line endings.

However, if you select it, keep in mind, what kind of editor you're using for editing files used in Git. Most Windows program uses Windows line ending, which is fine with this selection. But, some of them (like Notepad++, which I personally adore) may offer you an option to save files with Linux or other line ending.

If you use it, and leave above option enabled in Git for Windows configuration, you'll see nasty warnings after each commit. In other words, for local system, select an option which matches line endings used by your default text editor / programming IDE.

One important note about step 2. TortoisePlink.exe program is used by Git for Windows for password-less connections to remote git repositories. See my article about this for more details. Note, that TortoisePlink.exe (sometimes named TortoiseGitPlink.exe), that comes with installation of TortoiseGit, and plink.exe file, that you may find in your PuTTy's folder are two different programs. You should use first one!

Final words

After installing msysgit, you may proceed with TortoiseGit installation. You can get installer (both 32-bit and 64-bit) along with many language version (but which coder is lame enough to not use English one, huh? :]) from TortoiseGit page on Google Code.

Both mysysgit and TortiseGit does not store passwords directly, using SSH keys instead. Read this post for more info.

Leave a Reply