Skip to main content

Setting Up Git

Git

Git is a distributed version control system1.

Setting Up git

This2 .

Update the System

sudo apt update
sudo apt upgrade

Set up a Git username:

git config --global user.name ""

To confirm that you have set the username correctly,

git config --global user.name

The enclosing quotations marks are empty intentionally. You should type your username in between.

Set an email address:

git config --global user.email ""

To confirm that you have set the email address correctly,

git config --global user.email

If you opted to use the private GitHub email address, you can use a GitHub-provided noreply email address3. Then use this command instead,

git config --global user.email "id+username@users.noreply.github.com"

Configuring git

To change the default branch for git,

git config --global init.defaultBranch main

To enable colorful output with git,

git config --global color.ui auto

To set the default branch reconciliation behavior to merging,

git config --global pull.rebase false

Footnotes

  1. Git Documentation. (n.d.) About Version Control

  2. The Odin Project. (n.d.) Setting Up Git

  3. Github Inc. (2024). Setting your commit email address