Installing Git on Windows

There are two competing Git packages for Windows: a Cygwin-based Git and a native version called msysGit.

Originally, only the Cygwin version was supported and msysGit was experimental and unstable. But as this book went to press, both versions work well and support an almost identical set of features. The most important exception, as of Git 1.6.0, is that msysGit does not yet properly support git-svn. If you need interoperability between Git and Subversion, you must use the Cygwin version of Git. Otherwise, the version you choose is a matter of personal preference.

If you aren’t sure which one you want, here are some rules of thumb:

  • If you use Cygwin already on Windows, use Cygwin’s Git because it interoperates better with your Cygwin setup. For example, all your Cygwin-style filenames will work in Git, and redirecting program input and output will always work exactly as expected.

  • If you don’t use Cygwin, it’s easier to install msysGit because it has its own standalone installer.

  • If you want Git integration with the Windows Explorer shell (for example, the ability to right-click on a folder and pick Git GUI Here or Git Bash Here), install msysGit. If you want this feature but prefer to use Cygwin, you can install both packages without harm.

If you’re still in doubt about which package to use, install msysGit. Make sure you get the latest version (1.5.6.1 or higher), as the quality of Git’s Windows support steadily improves in successive versions.

Installing the Cygwin Git Package

The Cygwin Git package, as the name implies, is a package inside the Cygwin system itself. To install it, run Cygwin’s setup.exe program, which you can download from http://cygwin.com.

After setup.exe launches, use the default settings for most options until you get to the list of packages to install. The Git packages are in the devel category, as shown in Figure 2-1.

Cygwin setup

Figure 2-1. Cygwin setup

After choosing the packages you want to install, click Next a few more times until the Cygwin installation finishes. You can then start the Cygwin Bash Shell from your Start menu, which should now include the git command (Figure 2-2).

Cygwin shell

Figure 2-2. Cygwin shell

As an alternative, if your Cygwin configuration includes the various compiler tools like gcc and make, you can build your own copy of Git from source code on Windows under Cygwin by following the same instructions as on Linux.

Installing Standalone Git (msysGit)

The msysGit package is easy to install on a Windows system because the package includes all its dependencies. It even has SSH commands to generate the keys that repository maintainers require to control access. msysGit is designed to integrate well with the Windows-style native applications such as the Windows Explorer shell.

First, download the latest version of the installer from its home at http://code.google.com/p/msysgit. The file to collect is usually called something like the following: Git-1.5.6.1-preview20080701.exe.

After the download completes, run the installer. You should see a screen that looks something like Figure 2-3.

msysGit setup

Figure 2-3. msysGit setup

Depending on the actual version being installed, you may or may not need to click Next through a compatibility notice as shown in Figure 2-4. This notice concerns incompatibilities between Windows-style and Unix-style line endings, called CRLF and LF, respectively.

msysGit notice

Figure 2-4. msysGit notice

Click Next a few more times until you see the screen shown in Figure 2-5.

msysGit choices

Figure 2-5. msysGit choices

The best way to run msysGit day-to-day is via Windows Explorer, so check the two pertinent boxes, as shown.

In addition, an icon to start Git Bash (a command prompt that makes the git commands available) is installed in the Start menu in the section called Git. Since most of the examples in this book use the command line, use Git Bash to get started.

All the examples in this book work equally well on Linux and Windows, with one caveat: msysGit for Windows uses the older Git command names mentioned in The Git Command Line. To follow the examples with msysGit, enter git-add for git add.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.56.45