Project 1: Space Shooter

How to install Git

And do a simple configuration

Eero Saarinen

--

Git Logo by Jason Long

I will concentrate on installing Git on the Windows system, for macOS users Git is most likely already installed, same goes for Linux users in most cases. If your Linux does not have Git installed, you will most likely be able to install it from your Linux distros’ package manager. For all cases you can also download Git from Git’s webpage.

Once the installer has been downloaded, run the installer. For most users default settings are good, but there are two settings that should be looked at more closely.

The first one is the option to choose your default editor. Git uses this editor to create and write commit and tag messages. The default is, if all else fails, Vi editor, while it isn’t impossible to learn for first time users it might be a bit too much. That is why there are other options to choose from. For this reason I picked Visual Studio Code, since I’m familiar with it and I already have it installed.

The settings to look at when installing Git.

The second option is the name of the initial branch. Historically Git has used master as its initial branch name, but since 2020 main has been the preferred name. This can be changed later from the Git Bash, if you didn’t choose this option while installing Git, with the command:

git config --global init.defaultBranch main

Once Git has been successfully installed, open Git Bash and add your name and email address to Git config. These are used to identify the person who makes the commits, on solo projects it probably isn’t that important, but when working with others it is important to know who did what. Because I will use GitHub as my repository, I will use the same email address that I use for GitHub as my Git email address.

Example of the Git Bash.

To change these settings execute these commands in the Git Bash, do remember to change your name and email address in the appropriate places:

git config --global user.name "Your Name"
git config --global user.email "your@email.com"

--

--