Skip to content

Setting up Git on Windows

    Git, the ubiquitous source control platform, is a tool still not included on Windows by default – despite its initial release in 2005 by the creator Linux himself, Linus Torvalds. Today we’ll be going over the installation process on Windows, because while there is a convenient installation wizard provided here, it can be a little intimidating with the amount of options presented throughout it.

    One of the first options we’ll be presented with is a list of components we would like included in the installation. Sticking with the default options here is fine, though as a strong proponent of Windows Terminal I like to include the “Add a Git Bash Profile to Windows Terminal”.

    You’ll then be asked to choose a default editor to be used by Git. This is up to you and what editor you are most familiar with – VS Code, Sublime Text, Notepad++, etc. In my case, I have chosen VS Code.

    We’ll choose “Let Git decide” with regards to the naming of your initial branches. You could also go with “Override” and use “main”, but I feel it’s best to err on the side of caution and wait for Github to implement their default naming scheme, so as to avoid any potential issues down the line.

    Choose “Git from the command line and also from 3rd-party software in order to allow Git usage from the Windows Command Prompt as well as PowerShell.

    “Choosing the SSH executable” will depend on whether or not you already have PuTTY installed. If you do, opt for the second choice “Use (Tortoise) Plink”. Otherwise stick with the default, “Use bundled OpenSSH”.

    We’ll stick with the default “Open SSL library” when choosing our HTTPS transport backend. You may opt for “Windows Secure Channel Library” instead if you are using a company computer tied to an AD domain, so as to honor your organization’s own CAs.

    Choose “Checkout Windows-style, commit Unix-style line endings” when configuring line ending conversions. This promotes compatibility and prevents issues when working with Linux users, because of the different ways Linux and Windows treat line endings and carriage returns.

    We’ll use the default “MinTTY” as the terminal for Git Bash. This helps prevent any issues with character encoding.

    Choose the default option for `git pull`.

    Choose the default “Git Credential Manager” when choosing a credential helper.

    Again, use the defaults for “Configuring extra options”, which is to include “Enable file system caching” for a performance boost.

    Opt out of any experimental options unless you are sure you need them, so as to promote stability.

    After the install has been completed, we can verify that everything works by opening a Git Bash session in Windows Terminal. If you do not have Windows Terminal installed, you will instead want to type “Git Bash” into your Windows search, and open the first result (assuming it’s not a Bing search…)

    We’ll check the Git version on the command line using “git –version”

    If you are going to be regularly interacting with hosted repositories such as Github, we’ll want to set a global user email, using following command:

    git config --global user.email "<your email address>

    Now we’re ready to make commits! To make a commit to a repository on Github, we’ll need to provide some form of authentication. I’d recommend doing this by signing in with your browser if you are not going to be making commits regularly. This prevents the need for keeping track of and expiring tokens for security purposes.