In order to use Git, you’ll need to install it first.
The procedures vary depending on your operating system.
You can test the availability of Git by running
The output will either be the currently installed version of Git or something similar to
error: command "git" not found.
$ git --version git version 2.39.1
Most Linux distributions already come with a version of git. However, if this is not the case, you may install it via the package manager of your choice. For instance with the Advanced Packaging Tool (APT).
# e.g. Debian-based systems $ sudo apt-get install git # e.g. RedHat-based systems $ sudo dnf install git
We highly recommend to install Git on macOS via the package manager Homebrew. Unfortunately the folks from Apple didn’t include such a manager of their own. Luckily you can simply install it by running a single command, how sweet is that.
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
After Homebrew was installed, you can set up Git by running the following command:
$ brew install git
It is strongly recommended to use the WSL (Dev > WSL) and not GitBash anymore! After install you must follow the instructions for Linux!
Installing Git on Windows works the classic Windows way without touching the CMD at all.
You have two options:
Make sure to add git executables to your Windows PATH (it’s an option during the installation).
After successfully installing git you need to update the git config for commit messages:
$ git config --global user.name "YOUR NAME" $ git config --global user.email "YOUR@EMAIL"