Arch keeps Git in the official extra repository, so the clean path is a normal pacman install rather than an AUR helper or upstream tarball. Install Git on Arch Linux with pacman, then set your commit identity, confirm the git command is available, and add SSH authentication if you push to GitHub, GitLab, or another remote host.
On a minimal Arch system, bash: git: command not found usually means the git package is missing. Install the official git package with pacman, then confirm your shell finds /usr/bin/git.
Install Git on Arch Linux
Update Arch Linux Before Installing Git
Synchronize the package database and upgrade installed packages before adding Git. Arch expects a current system before new package installs, which helps avoid dependency mismatches on rolling-release systems:
sudo pacman -Syu
These commands use
sudofor tasks that need root privileges. If your user is not in the sudoers file yet, run the commands as root or follow the guide on how to add and manage sudo users on Arch Linux.
Install Git with Pacman
The official Arch package database lists git in the extra repository. Install it with pacman:
sudo pacman -S git
This installs the git command, core Git tools, and package-managed updates through pacman. The optional tk package is only needed if you plan to use git gui or gitk; normal clone, commit, push, and pull workflows do not need it.
If you searched for the GitHub CLI or the gh command, use the separate official Arch package named github-cli. Git handles repository operations such as clone, commit, push, and pull; GitHub CLI handles GitHub-specific work such as issues, pull requests, releases, and authentication helpers.
Verify the Git Installation
Confirm that your shell can find the Git binary, then check the installed version:
command -v git
git --version
Relevant output includes:
/usr/bin/git git version 2.x.x
The exact version changes as Arch publishes new Git packages. Seeing /usr/bin/git and a git version line confirms the package is installed and active on your PATH.
Configure Git on Arch Linux
Git needs a username and email address before it can create commits. These values become part of each commit, so use the name and email you want collaborators or hosting platforms to see.
Set Your Git Username and Email
Configure your global identity that applies to all repositories on your system:
git config --global user.name "Your Name"
git config --global user.email "your_email@example.com"
Replace Your Name and your_email@example.com with your actual name and the email address associated with your Git hosting account (GitHub, GitLab, or similar).
Set the Default Branch Name
Modern Git repositories use main as the default branch name. Configure this to avoid the hint: Using 'master' as the name for the initial branch message when creating new repositories:
git config --global init.defaultBranch main
Set the Default Text Editor
Git opens a text editor for commit messages, interactive rebase operations, and merge conflict resolution. Set your preferred editor:
git config --global core.editor "nano"
Replace nano with vim, code --wait (for VS Code), or any other editor you prefer.
Verify Your Git Configuration
Review all global configuration settings to confirm your changes:
git config --list --global
Expected output:
user.name=Your Name user.email=your_email@example.com init.defaultbranch=main core.editor=nano
Git stores global configuration in ~/.gitconfig. Repository-specific settings created with git config --local live in that repository’s .git/config file and override global values for that project. For more examples of identity precedence, see the guide on how to configure Git username and email.
Set Up SSH Authentication for Git on Arch Linux
SSH keys let Git authenticate to remote hosting platforms without pasting a personal access token for every push. HTTPS remains valid when SSH is blocked by a network, but SSH is usually more convenient for daily GitHub, GitLab, and self-hosted repository work.
Install OpenSSH
If ssh or ssh-keygen is missing on your Arch system, install the openssh package. It provides the SSH client and key generation tools that Git uses for SSH transport:
sudo pacman -S openssh
For a complete walkthrough of SSH configuration including server setup and security hardening, see how to install OpenSSH on Arch Linux.
Generate an SSH Key Pair
Create a new ED25519 key pair for Git authentication:
ssh-keygen -t ed25519 -C "your_email@example.com"
Press Enter to accept the default file location (~/.ssh/id_ed25519) and optionally set a passphrase for additional security:
Generating public/private ed25519 key pair. Enter file in which to save the key (/home/username/.ssh/id_ed25519): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/username/.ssh/id_ed25519 Your public key has been saved in /home/username/.ssh/id_ed25519.pub
Add Your SSH Key to the Agent
Start the SSH agent and add your private key so you do not have to enter the passphrase repeatedly:
eval $(ssh-agent -s)
ssh-add ~/.ssh/id_ed25519
Copy the Public Key
Display your public key to copy it to your Git hosting provider (GitHub, GitLab, or similar):
cat ~/.ssh/id_ed25519.pub
Copy the entire output and add it to your Git hosting account’s SSH key settings. GitHub documents this under connecting to GitHub with SSH; GitLab and other hosting platforms use the same public-key concept with their own account settings screens.
Test SSH Authentication
Verify your SSH key works with GitHub:
ssh -T git@github.com
Expected output on successful authentication:
Hi username! You've successfully authenticated, but GitHub does not provide shell access.
For GitLab, use ssh -T git@gitlab.com instead.
Basic Git Commands on Arch Linux
These essential commands cover the daily Git workflow for creating repositories, tracking changes, and collaborating with remote repositories.
Initialize a New Repository
Create a new Git repository in the current directory:
mkdir ~/my-project && cd ~/my-project
git init
Expected output:
Initialized empty Git repository in /home/username/my-project/.git/
Clone an Existing Repository
Download a remote repository to your local machine:
git clone git@github.com:username/repository.git
For HTTPS cloning (when SSH is not configured):
git clone https://github.com/username/repository.git
Stage and Commit Changes
Track file changes and record them in the repository history. Stage all modified and new files, then commit with a descriptive message:
git add .
git commit -m "Add initial project files"
To stage specific files instead of everything, replace the period with the file path: git add filename.txt.
Push Changes to a Remote Repository
Upload your local commits to the remote repository:
git push origin main
Pull Changes from a Remote Repository
Download and merge remote changes into your local branch:
git pull origin main
Check Repository Status and History
View the current state of your working directory and staging area:
git status
View the commit history with a compact, graphical representation:
git log --oneline --graph --decorate
For more Git operations, see the guides on switching Git branches, renaming Git branches, undoing Git commits, and clearing the Git cache.
Enable Git Bash Completion on Arch Linux
Bash completion allows you to press Tab to autocomplete Git commands, branch names, and remote references, which speeds up your workflow and reduces typing errors.
Install Bash Completion
The Git package includes completion scripts, but you need the bash-completion framework to enable them:
sudo pacman -S bash-completion
After installation, start a new terminal session or source the completion script manually:
source /usr/share/git/completion/git-completion.bash
To load Git completion permanently, add the source line to your ~/.bashrc file. If you use Zsh, Git completion loads automatically through the Zsh completion system.
Enable Git Prompt Information
Display the current branch name and repository state directly in your shell prompt. Source the Git prompt script and update your PS1 variable:
source /usr/share/git/completion/git-prompt.sh
PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '
Add both lines to your ~/.bashrc to make the prompt change persistent. When you enter a Git repository, the prompt displays the current branch name in parentheses.
Troubleshoot Git on Arch Linux
These are the most common issues encountered when using Git on Arch Linux and how to resolve them.
Git Command Not Found on Arch Linux
Bash prints this error when the git binary is not installed or the current shell cannot find it on PATH:
bash: git: command not found
Install the official Arch package, then verify that /usr/bin/git is visible to your shell:
sudo pacman -Syu
sudo pacman -S git
command -v git
Expected output:
/usr/bin/git
If Git is installed but command -v git still returns nothing, open a new terminal session and check that /usr/bin appears in your PATH.
Fatal: Not a Git Repository
This error appears when running Git commands outside a repository or in a directory that has not been initialized:
fatal: not a git repository (or any of the parent directories): .git
Verify you are in the correct directory, then initialize or clone a repository:
pwd
git init
Permission Denied (Publickey) When Pushing
SSH authentication failures produce this error when pushing to remote repositories:
git@github.com: Permission denied (publickey). fatal: Could not read from remote repository.
Verify your SSH key is loaded and test the connection:
ssh-add -l
ssh -T git@github.com
If no keys are listed, add your key to the SSH agent:
eval $(ssh-agent -s)
ssh-add ~/.ssh/id_ed25519
Also confirm your public key is added to your Git hosting account’s SSH key settings.
Author Identity Unknown Error
Git refuses to create commits without configured user information:
Author identity unknown *** Please tell me who you are.
Set your identity as described in the configuration section:
git config --global user.name "Your Name"
git config --global user.email "your_email@example.com"
SSL Certificate Problem When Cloning
Corporate proxies or outdated CA certificates can cause HTTPS clone failures:
fatal: unable to access 'https://github.com/...': SSL certificate problem: unable to get local issuer certificate
Update the CA certificates package:
sudo pacman -S ca-certificates
If you are behind a corporate proxy that replaces SSL certificates, configure Git to use the proxy’s CA bundle:
git config --global http.sslCAInfo /path/to/corporate-ca-bundle.crt
Never disable SSL verification globally with
git config --global http.sslVerify false. This exposes all Git traffic to man-in-the-middle attacks. If you must bypass verification, limit it to a single repository usinggit config --local http.sslVerify falseand only as a temporary measure.
Update or Remove Git from Arch Linux
Update Git with Pacman
Git updates arrive through normal Arch system upgrades. There is no separate Git updater to run when the package comes from the official repositories:
sudo pacman -Syu
Remove the Git Package
If you no longer need Git, remove the package and orphaned dependencies with pacman’s recursive nosave removal flags:
sudo pacman -Rns git
The -Rns flags remove the package, delete package backup configuration files instead of creating .pacsave files, and remove dependencies that no other installed package requires.
If pacman reports that another installed package requires git, keep Git installed or remove the dependent package first. Do not use force flags to break package dependencies.
Verify Git Removal
Confirm that the git command is no longer on PATH:
hash -r
command -v git || echo "git is not in PATH"
Expected output:
git is not in PATH
Remove User Git Configuration
Pacman does not delete local repositories or user-level Git configuration. Keep ~/.gitconfig if you plan to reinstall Git later or want to preserve your author identity and editor preferences.
Only remove
~/.gitconfigwhen you are sure you no longer need those global Git settings. Local repositories in project directories are separate and remain on disk unless you delete those project folders yourself.
Inspect the file first, then remove it interactively if you want a clean user-level reset:
if test -f ~/.gitconfig; then
cat ~/.gitconfig
rm -i ~/.gitconfig
fi
Conclusion
Git is installed on Arch through pacman, configured with a global identity, and ready for SSH or HTTPS remotes. Regular sudo pacman -Syu upgrades keep it current with Arch’s rolling packages. For deeper Git behavior, the Arch Wiki Git page and Pro Git book are solid references; for daily tasks, start with switching Git branches or undoing Git commits.


Formatting tips for your comment
You can use basic HTML to format your comment. Useful tags currently allowed in published comments:
<code>command</code>command<strong>bold</strong><em>italic</em><blockquote>quote</blockquote>