Git is a distributed version control system used to manage changes to text files.
On OS/X, git is part of the xcode command line tools. This is easy to install, but it can take a long time. Instead, you can install git alone, but you need to complete additional configuration.
-
Download git for Mac from the binary installer option here: https://git-scm.com/download/mac. Note: the installer links to a Sourceforge downloader, but the latest version may not download by default. Scroll down to get the latest version of git (as of October 2021, that is version 2.33)
-
Install git from the .dmg file.
-
After installing, you also have to add its directory to your path. From terminal, type:
echo "PATH=/usr/local/git/bin:\$PATH" >> ~/.bash_profile
thensource ~/.bash_profile
-
Re-open terminal and Test install
-
Open a terminal.
-
Type the following in the terminal:
xcode-select --install
As part of installing git, install the gitbash command line environment so that the command line is consistent across Windows, OSX and Linux.
-
Download git for windows: https://git-scm.com/download/win
-
Click on the git installer:
- Accept the license and click
Next
:
- Select the installation folder, default is fine. Click
Next
:
- Select the components to be installed, the default is fine:
- Windows Only: select start menu folder (default is fine):
- Choose the default editor used by Git. Select
Visual Studio Code
as the default editor. (Note that you must installVisual Studio Code
first before you can move forward past this step of the Git install.) ClickNext
:
- You may be prompted to change "the name of the initial branch." The emerging standard seems to be "main," so if you see the following dialogue box, select "Override the default branch name for new repositories," type "main" in the text box, and then click
Next
:
- Choose the "Git from the command line and also from 3rd-party software" radio button and then click
Next
:
- Choose "Use bundled OpenSSH". Click
Next
:
- Choose "Use the OpenSSL library". Click
Next
:
- Configure the line ending conversions (the default is fine). Click
Next
:
- On the 'configuring the terminal emulator to use with Git Bash' window, choose the "Use Windows default console window" option:
Note: Do not choose "Use MinTTY (the default terminal of MSYS2)" as that will break Python.
- Configure the default behavior of 'git pull' (the default is fine).
- Configure credential helper. The default option "Git Credential Manager" is what you want. Click
Next
:
- Configure extra options (the defaults are fine). Click
Next
:
- Configure experimental options (the defaults are fine). Click
Install
:
- Git should now be installing:
- Click through the rest of the install, leaving the defaults, and then click
Finish
on the last window:
Test that git is installed:
git
The terminal should print something like (note that this is truncated):
usage: git [--version] [--help] [-C <path>] [-c name=value]
[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p | --paginate | --no-pager] [--no-replace-objects] [--bare]
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
<command> [<args>]
Check which development version of Git is currently installed on the computer:
git --version
Check for the most recent development version of Git on their website here. As of October 2021, the most recent development version of Git is 2.33.1.
To update a computer that already has an earlier development version:
Open the Git website downloads page in a browser and follow the posted download instructions according to the computer type: Mac, Linux/Unix, or Windows.
Then, check that the new development version of Git is now installed:
git --version