Git Installation Guide

Git is a distributed version control system for tracking changes in source code.

Installation

Ubuntu/Debian

sudo apt update
sudo apt install -y git

Fedora

sudo dnf install -y git

Arch Linux

sudo pacman -S git

Configuration

git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
git config --global init.defaultBranch main
git config --global pull.rebase false

Generate SSH Key

ssh-keygen -t ed25519 -C "your.email@example.com"
cat ~/.ssh/id_ed25519.pub

Add the public key to your GitHub/GitLab account.

Verification

git --version

Basic Commands

git init                    # Initialize repository
git clone <url>            # Clone repository
git add .                  # Stage all changes
git commit -m "message"    # Commit changes
git push origin main        # Push to remote
git pull                   # Pull from remote
git status                 # Check status
git log                    # View history