Full-stack Web Technologies

CHAPTER 1
Install & Configure

Installing Git

The goal when installing git is to be able to open a terminal and type:

git

and receive a page of text showing you some help using Git. If you type:

git --version

you should get a version around 2.40.

Installation is different depending on your operating system.

Linux

Command to install git from a terminal:

  • Ubuntu: sudo apt install git
  • Fedora: sudo dnf install git
  • Arch: sudo pacman -S git

MacOS

MacOS might come with git preinstalled, but if open a terminal and type git and it is not installed, it will prompt you to install Xcode Command Line Tools, which include it.

Another option is to install it using Homebrew, by typing brew install git.

Windows

Use the official installer, which also installs a Bash terminal.

Configuring Git

Git has some internal variables that can be configured. The most important is your identity, which will be used to "sign" your work.

To configure your identity for all Git projects, you have to alter the Git global configuration, which is stored in your account. At least you should set both your name and email.

This information will be public, so make sure it is accurate

To configure your name and email, open a terminal and type:

git config --global user.name "James Bond"
git config --global user.email "james@bond.com"

Unless you truly are James Bond, just replace your name and email in there 😉.

Name the default branch

Another setting which might come in handy is the name given to the "main" branch when Git initializes a repository:

git config --global init.defaultBranch main

It used to be called "master", but since it has a bad connotation, this was changed to "main" (in particular, in GitHub). Through this variable you can choose whatever you want (but "main" is the recommended name nowadays).