How to Set Up Git on Linux and macOS
Git is the most widely used version control system. This guide walks through installing Git, configuring your identity, and creating your first repository.
Install Git
sudo apt install git # Debian/Ubuntu brew install git # macOS
Configure Identity
git config --global user.name "Your Name" git config --global user.email "[email protected]"
Initialize a Repository
mkdir myproject && cd myproject git init git add . git commit -m "Initial commit"
Connect to GitHub
git remote add origin https://github.com/user/repo.git git push -u origin main