Git Installation Setup
Prerequisites
Before installing Git, ensure your Ubuntu 22.04 system is updated:
sudo apt update
sudo apt upgrade
Installation Methods
Method 1: Using APT Package Manager
Install Git directly from Ubuntu's default repositories:
sudo apt install git
Method 2: Adding Git PPA (Personal Package Archive)
For the latest Git version:
sudo add-apt-repository ppa:git-core/ppa
sudo apt update
sudo apt install git
Verification
Check Git installation and version:
git --version
Initial Configuration
Setting User Name and Email
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
Configuration Levels
graph TD
A[System Level] --> B[Global Level]
B --> C[Local Level]
Configuration Level |
Scope |
File Location |
System |
All users |
/etc/gitconfig |
Global |
Current user |
~/.gitconfig |
Local |
Current repository |
.git/config |
Optional: SSH Key Setup
Generate SSH key for secure repository access:
ssh-keygen -t rsa -b 4096 -C "[email protected]"
LabEx Recommendation
LabEx provides comprehensive Git environment setups for seamless learning and development experiences.