Install Git¶
It is highly recommended to install and use the package manager Homebrew for many programs, including git. If you do not have Homebrew installed follow the instructions on Homebrew.
Once Homebrew is installed, install Git using command:
brew install git
Git might already be installed on your system bundled with Xcode Command Line Tools If not you can install Xcode Command Line Tools with xcode-select --install
A dialog will appear; click Install and wait for it to finish.
Confirm the installation:
git --version
Use your distribution's package manager:
# Debian / Ubuntu
sudo apt update && sudo apt install git
# Fedora
sudo dnf install git
# Arch
sudo pacman -S git
Confirm the installation:
git --version
Download and run the installer from git-scm.com/downloads.
During setup:
- Leave the default editor as-is (or choose one you know).
- On the "Adjusting your PATH environment" screen, keep the recommended option "Git from the command line and also from 3rd-party software".
- Accept all other defaults unless your local IT policy requires something else.
After installation, open Git Bash (installed alongside Git) or PowerShell and confirm:
git --version
Git Configuration¶
You need to tell git who you are so that your commits will be properly labeled. Run the following commands in your terminal, replacing the placeholders with your own information:
git config --global user.name "Your Name"
git config --global user.email "you@example.org"
After installing, check your configurations
git config --list --show-origin
You should see your name and email listed the last two lines of the output like this:
