Installing Git
Installing Git
After this page you have a current git on your PATH on Linux and can print its version.
Check what you already have
git --version
which -a gitThis book wants 2.45 or newer on Linux. Examples were checked against 2.55. You need git switch, git restore, and (later) SSH commit signing.
Most desktop distros already ship a new enough Git. If which git prints /usr/bin/git and the version is 2.45+, you are done.
Install from the distro
Arch Linux and Omarchy
pacman -Q git
# missing or too old:
sudo pacman -S gitDebian and Ubuntu
sudo apt update
sudo apt install gitFedora
sudo dnf install gitEnterprise images sometimes freeze Git at 2.25. If git --version is older than 2.45, use your distro’s backports or a current tarball from git-scm.com so switch and restore exist.
Line endings and the filesystem
Linux stores LF line endings and executable bits. Leave core.autocrlf unset. Leave core.fileMode at the default (true) so chmod +x is recorded. Those defaults are why hooks and scripts in later chapters work with chmod +x hook.sh.
What else you need for Parts I–II
| Tool | Role |
|---|---|
| A Linux terminal | Where you run git (bash or another POSIX shell) |
| A text editor | nvim in this book’s config examples; any editor is fine |
Docker, Kubernetes, and a forge account wait until later parts.
Set core.editor once you know which editor you type in (next page). Until then, git commit -m "message" avoids opening one.
Confirm
git --version
which git
echo "$HOME"$HOME should be /home/<you>. Then set identity and the three config layers on the next page.