Installing Git - 14 days of Git
Tags: 14daysofgit, git, devops
Published: 2022-09-16 11:33:08

So far on my 14 days of Git learning journey I have dug into: 

- [What is version control?](https://www.techielass.com/what-is-version-control)

- [What is Git?](https://www.techielass.com/what-is-git)

Now it's time to get hands on with Git and get the tool installed on my computer. 

## Install Git on Windows
Git is a tool that can be installed on your macOS, Windows or Linux operating system.  We'll focus on Windows installation methods here. 

- Head over to [https://git-scm.com/downloads](https://git-scm.com/downloads) and download the latest version of the client.
- Once you have downloaded the right file, double click on it to start the install.

The install is down through a wizard, you will be asked some basic questions: 

- Accept the license
- Install location

## Components
And then you will be asked what components you should install.  The defaults are generally okay to get you started with Git.  You may want to select the option to install an icon on your desktop and set it to check for updates daily. 


![Git installation optional checkboxes](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nmj6c3m0uj3f5tqd3ryn.PNG)

The other optional component you might want to consider is the _"Add a Git Bash Profile to Windows Terminal"_.   This can be useful later on, especially if you are planning on using Visual Studio Code or another editor that has a built in terminal window.

## Start Menu Folder
You can leave the next screen at it's default setting. 

## Default Editor
When you get to choosing the default editor used by Git, you have the option to select from a list of editors.  The default is Vim, however I would suggest picking one you are more familiar with. 

## Initial Branch name
When you create a new repository, by default Git will call that first branch "master".  You can confirm it so that it will use another name.  I recommend setting this to "main". 


![Git Installation Branch Name](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fsqm9714rjdsoaybcr6j.PNG)

## PATH environment
When you use a tool within the command line without specifying the full location path, you need to configure it so that Windows knows where the tool is.  I recommend using the default option here to configure the PATH settings. 

## SSH Executable
I prefer to leave this option as is by choosing OpenSSH. 

## Line ending conventions
Again I leave this is default. 

## Terminal emulator for Git Bash
This is another setting that is best left at the default MinTTY option.  It is the more modern choice. 

## Default behaviour
It is best to leave this option at "Default (fast-forward or merge)".  Most tutorials you will follow will assume you are using this setting.  And until you get more familiar with Git and it's workings it is the best option. 

## Git credential helper
When working with external Git repositories it is best practice to use multi-factor HTTPS authentication.  It is best to leave the default option by using the built in [Git Credential Manager](https://github.com/GitCredentialManager/git-credential-manager/). 

## Extra options
Best to go with the defaults here, unless you have any other need to configure them. 

## Experimental options
I tend not to install any experimental options, but again if you have a need or want to try them that is something for you to decide. 

The installation process should now begin. 

![Git Installation](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1p37i63jk99qs45r1jh0.PNG)

## Install Git with Windows Package Manager
[Windows Package Manager (winget)](https://www.techielass.com/get-started-with-windows-package-manager/) is an open source package manager developed and built by Microsoft.  It can help you install, manage and upgrade software on your Windows desktops. 

If you have Windows Package Manager installed on your machine, you can use the following command to install Git:

```bash
winget install git.git
```

## Install Git with Chocolatey
[Chocolatey](https://www.techielass.com/chocolatey-what-is-it/) is an open source package manager that can help you install, manage and upgrade software on your Windows desktops and servers.

If you have Chocolatey installed on your machine and it's your package manager of choice you can use the following command to install Git:

```bash
choco install git
```

## Configure Git for use
Before we start to use Git there are a few things that we need to configure.  Setting your name and your email address is the first step.  This information is use to record any changes you make to Git repositories. 

Open up a command line tool and type in the following: 
```bash
git config --global user.name "Your Name"
git config --global user.email “you@example.com”
```

## 14 days of Git
The next step of 14 days of Git is to start to use Git and get familiar with the basic commands! Be sure to [subscribe](https://www.techielass.com/newsletter) and join us for that step in the learning journey!

You can follow along here: [https://github.com/weeyin83/14daysofgit](https://github.com/weeyin83/14daysofgit)