Git Install and Config
Before you can start tracking a project, Git needs to be installed and told your name and email so it can correctly label every commit you make.
Installing Git on Your System
Git is available on Windows, macOS, and Linux, and the installation method differs slightly for each. On Windows, you download and run the official installer from the Git website, which also provides Git Bash, a terminal that behaves like a Linux shell. On macOS, Git ships with the Xcode Command Line Tools, or can be installed through the Homebrew package manager. On Linux, Git is available through your distribution's package manager.
- Windows: download the installer from git-scm.com and run it
- macOS: run 'xcode-select --install', or 'brew install git' if you use Homebrew
- Debian/Ubuntu: 'sudo apt update && sudo apt install git'
- Fedora: 'sudo dnf install git'
- Arch Linux: 'sudo pacman -S git'
Example
$ git --version
git version 2.44.0Telling Git Who You Are
Every commit you create is stamped with an author name and email address, and Git refuses to let you commit until these are set at least once. This information is what shows up in the project history and, if you push to GitHub or GitLab, in the contribution graph and commit list.
Example
$ git config --global user.name "Ada Lovelace"
$ git config --global user.email "ada@example.com"
$ git config --global --list
user.name=Ada Lovelace
user.email=ada@example.comChoosing a Default Editor
Some Git commands, like writing a commit message without -m or editing history interactively, open a text editor. On many systems the default is Vim, which can be confusing if you have never used it. You can point Git at an editor you are comfortable with instead.
Example
$ git config --global core.editor "code --wait"
$ git config --global core.editor "nano"Exercise: Git Install and Config
What does `git config --global user.name "Alex"` set?