If you’re developing software on Arch Linux, Git is not optional—it’s essential. Whether you’re pushing code to GitHub, collaborating on GitLab, or managing private repositories, Git gives you full control over version history, branching strategies, and distributed collaboration.

Originally created by Linus Torvalds, Git has become the industry standard distributed version control system. In this step-by-step guide, you’ll learn how to:

  • Install Git on Arch Linux
  • Configure Git for first-time use
  • Set up secure SSH authentication
  • Use essential Git commands
  • Enable bash completion
  • Troubleshoot common errors
  • Remove Git safely

Let’s get started.

Update Arch Linux Before Installing Git

Arch Linux follows a rolling release model, meaning updates are continuous. Before installing new packages, always synchronize your system to prevent dependency issues.

READ 👉  Enhance Your Website Slideshows with JavaScript Animations

Run:

sudo pacman -Syu

This command:

  • Syncs the package database
  • Upgrades all installed packages
  • Ensures you receive the latest stable Git version

Keeping your system updated is critical for security and compatibility.

Install Git on Arch Linux

Git is available in the official Arch repositories. Installation takes seconds.

sudo pacman -S git

This installs:

  • Git command-line tools
  • Merge and diff utilities
  • HTTP, HTTPS, and SSH support
  • Optional GUI tools (git-gui, gitk if Tk is installed)

Verify the Installation

Confirm Git is installed:

git --version

Example output:

git version 2.53.0

Since Arch Linux continuously updates packages, you’ll always receive the latest stable Git release during regular system upgrades.

Configure Git for First-Time Use

Before making commits, Git requires identity information. This ensures every commit is properly attributed.

Set Your Global Username and Email

git config --global user.name "Your Name"
git config --global user.email "your_email@example.com"

These values appear in every commit you create.

Set the Default Branch to “main”

Modern repositories use main instead of master.

git config --global init.defaultBranch main

Choose Your Default Text Editor

Git opens a text editor for commit messages and merges.

Example with nano:

git config --global core.editor "nano"

Other common options:

  • vim
  • code --wait (VS Code)
  • micro

Verify Configuration

git config --list --global

Git stores global settings in:

~/.gitconfig

Repository-specific settings override global values and are stored in:

.git/config

Set Up SSH Authentication for Git (Recommended)

Using SSH keys allows secure, passwordless authentication when working with remote repositories on platforms like GitHub or GitLab.

SSH is more secure and more convenient than repeatedly entering passwords or tokens.

READ 👉  Harden Your Linux System with systemd Security Options: A Comprehensive Guide

Install OpenSSH

sudo pacman -S openssh

Generate a New SSH Key

Use modern ED25519 encryption:

ssh-keygen -t ed25519 -C "your_email@example.com"

Press Enter to accept the default location:

~/.ssh/id_ed25519

You can optionally add a passphrase for additional protection.

Start the SSH Agent and Add Your Key

eval $(ssh-agent -s)
ssh-add ~/.ssh/id_ed25519

Copy Your Public Key

cat ~/.ssh/id_ed25519.pub

Copy the output and add it to your Git hosting account under:

Settings → SSH Keys → New SSH Key

Test the Connection

For GitHub:

ssh -T git@github.com

Successful authentication looks like:

Hi username! You've successfully authenticated.

Essential Git Commands for Daily Use

Here are the most important Git commands every developer should know.

Initialize a New Repository

mkdir my-project
cd my-project
git init

Clone a Remote Repository

SSH:

git clone git@github.com:username/repository.git

HTTPS:

git clone https://github.com/username/repository.git

Stage and Commit Changes

Stage all files:

git add .

Commit changes:

git commit -m "Initial commit"

Push Changes to Remote

git push origin main

Pull Updates from Remote

git pull origin main

Check Status

git status

View Commit History

git log --oneline --graph --decorate

Enable Git Bash Completion on Arch Linux

Bash completion improves productivity by auto-completing:

  • Branch names
  • Commands
  • Remote references

Install bash completion:

sudo pacman -S bash-completion

Load it manually:

source /usr/share/git/completion/git-completion.bash

To make it permanent, add it to your ~/.bashrc.

Show Current Git Branch in Terminal Prompt

Enable Git prompt support:

source /usr/share/git/completion/git-prompt.sh

Update your prompt:

PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '

Now your terminal displays the active Git branch automatically.

Troubleshooting Git on Arch Linux

Here are common Git errors and their fixes.

Fatal: Not a Git Repository

You’re not inside a repository.

Fix:

git init

Or navigate to the correct directory.

READ 👉  How Can I Back Up My Important Data And Files?

Permission Denied (publickey)

SSH key not loaded or not added to hosting provider.

Check loaded keys:

ssh-add -l

Add key:

ssh-add ~/.ssh/id_ed25519

Verify connection:

ssh -T git@github.com

Author Identity Unknown

You haven’t configured your name and email.

Fix:

git config --global user.name "Your Name"
git config --global user.email "your_email@example.com"

SSL Certificate Errors

Update certificates:

sudo pacman -S ca-certificates

Never disable SSL verification globally—it creates security risks.

How to Remove Git from Arch Linux

If you no longer need Git:

sudo pacman -Rns git

Flags explained:

  • -R remove package
  • -n delete config files
  • -s remove unused dependencies

Verify removal:

git --version

Note: This does not delete your repositories or ~/.gitconfig.

Frequently Asked Questions

Is Git installed by default on Arch Linux?

No. Arch Linux uses a minimal installation approach. Git must be installed manually.

How do I update Git?

Run:

sudo pacman -Syu

Since Arch is rolling release, Git updates automatically.

Should I use SSH or HTTPS?

SSH is recommended for:

  • Stronger security
  • No repeated password prompts
  • Better automation support

HTTPS is simpler initially but requires tokens or credential helpers.

Final Thoughts

Installing and configuring Git on Arch Linux is straightforward—but setting it up correctly makes a major difference in productivity and security.

By:

  • Installing Git via pacman
  • Configuring your global identity
  • Setting up SSH authentication
  • Enabling bash completion

You create a professional, efficient development environment that scales from personal projects to enterprise collaboration.

Because Arch Linux is a rolling release distribution, your Git installation will always stay up to date with regular system upgrades—no extra steps required.

Whether you’re contributing to open source, managing DevOps workflows, or building production applications, Git remains the backbone of modern software development.

Did you enjoy this article? Feel free to share it on social media and subscribe to our newsletter so you never miss a post!

And if you'd like to go a step further in supporting us, you can treat us to a virtual coffee ☕️. Thank you for your support ❤️!
Buy Me a Coffee

Categorized in: