sudo apt update sudo apt install git -y Verify the installation:
git config --list You have three good options. Choose one . Option A: GitHub CLI (recommended) Install GitHub CLI:
cat ~/.ssh/id_ed25519.pub Test the connection:
ssh-keygen -t ed25519 -C "your-email@example.com" Display the public key and add it to GitHub ():
echo "# My Ubuntu Project" > README.md Stage and commit:
sudo apt install gh -y Authenticate:
git add README.md git commit -m "Add README" git push origin main If you use a token or SSH, the push will succeed immediately. Step 5: Keep Your Local Repository Updated Pull the latest changes from GitHub: