This lab will guide you through the steps for installing Git on your system. If you already have Git installed, you can skip to the next chapter. Otherwise, select the appropriate section for your operating system, and follow the instructions.
The Git for Windows package installs a version of Git that also includes a Bash (Unix) shell that runs on top of Windows and provides a Unix-style interface to Git. You can also integrate Git with the Windows Explorer and command prompts.
The following instructions provide the necessary steps for installation, as well as additional information on the install screens you will encounter during the process.
Each of the following numbered steps represents a new screen of the installation tool.
http://git-scm.com/download/win
. The download starts automatically.If you plan to use Windows editors, then the first setting—Checkout Windows-style, commit Unix-style—will probably work best. This setting means that when you get text content out of Git, Git updates the line endings in the checked-out files to be carriage-return/line-feed (CRLF). This is the line ending expected by Windows editors. When you check in (or commit) content back into Git, Git strips out the CRs and stores (normalizes) the text/ASCII files with line endings that are just LF (the default for Unix).
On the other hand, if you plan to edit with Unix-based editors (vi or others) or work primarily through the Bash shell, then the Checkout as-is, commit Unix-style line endings setting may be the best choice. This doesn't make any changes to the files on checkout, but normalizes them to LFs when storing them in Git. So, essentially, they will always have LFs. Because LF-only is the default for Unix systems, this works well for editing in that environment.
The last choice—Checkout as-is, commit as-is—can be problematic. Basically, this tells Git not to make any changes for line endings—just to leave them as they are. This means that you can end up with a mixture of line endings in the repository. The other two options normalize files in the repositories to LFs. If a file is edited in a Windows editor and then stored back in Git, the file stored in the Git repository will contain CRLFs. However, if edits are done in Unix editors, the files will have just LFs stored in the repository. If someone then gets one of these files out on an OS that is different from the OS where it was last edited, they may be surprised by the line endings being in the style of the other OS. This can be especially troublesome for teams where some members use Unix and other members use Windows.
You can change this setting at a later time by changing the configuration value for core.autocrlf that is mentioned here. (I cover this in more detail in Chapter 4.) However, at that point, there may already be files stored in the repository with undesired line endings. There are ways to fix these files that are beyond the scope of this discussion.
For most of the work you'll do in the Connected Labs for this book, the value of this setting won't be significant. However, the best practice here is to choose one of the first two settings that best corresponds to the OS type where you plan to run your editors.
The Git Credential Manager for Windows is a successor to a previous credential management application. It essentially helps with managing and simplifying different types of access for Git from various applications. Its use is generally transparent to the user. You can read more about this application in the README file for the project on the GitHub hosting site at https://github.com/Microsoft/Git-Credential-Manager-for-Windows/blob/master/README.md
.
Unless you have a specific reason not to use this application, just leave it checked.
The Git CMD window is like a Windows command prompt. However, you can start up a Windows command prompt and also have access to Git in this window.
$ git --version
to make sure you have Git installed and are running at the expected version.
http://git-scm.com/download/mac
. The download starts automatically. If not, there is a link you can click to start it.$ git --version
http://git-scm.com/download/linux
.$ git --version