Configure the git environment by using .gitconfig.

  • System-wide: /etc/gitconfig
    • Applies to all users and all repositories
  • Global: ~/.gitconfig
    • Specific to a user account across all repositories in the system. The Name and Email are set here
  • Local: .git/config
    • Specific to a local git repo

Name and Email for git commits

[user]
  name = User Name 
  email = user@email.com

Create commonly used shortcuts with Alias

[alias]
  co = checkout
  br = branch
  cm = commit
  st = status

Enable or disable color output

[color]
  ui = auto

Set the default branch name

[init]
  defaultBranch = main

Set the preferred text editor for commit messages

[core]
  editor = vim

Use git rebase for a cleaner history

[pull]
  rebase = true

These can be set using the git config command

git config --global user.name = "User Name"
git config --global user.email = "user@example.com"

View the full configuration with

git config --list