Published on: Mon Jan 26 2026
Author - Himanshu Sharma
Connect Git with GitHub (Step-by-Step)

Step 1 – Check Git
This guide shows the fastest and easiest way to connect your local Git project with GitHub.
First Check Git is installed or not:
git --versionIf not, install it:
sudo apt install gitStep 2 – Set Git User
git config --global user.name "Your Name"
git config --global user.email "youremail@gmail.com"Verify:
git config --listStep 3 – Generate SSH Key
ssh-keygen -t ed25519 -C "youremail@gmail.com"Press Enter for all options.
Start SSH agent:
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519Copy the key:
cat ~/.ssh/id_ed25519.pubStep 4 – Add SSH Key to GitHub
- Open https://github.com/settings/keys
- Click New SSH Key
- Paste the copied key
- Save
ssh -T git@github.comStep 5 – Create & Connect to Repo
- Open GitHub → New Repository
- Enter name
- Click Create
Go to your project folder
Run:
git init
git add .
git commit -m "Initial commit"Connect GitHub,
Replace with your Repo ssh url:
git remote add origin git@github.com:YOUR_USERNAME/REPO_NAME.gitPush:
git branch -M main
git push -u origin mainNow you're ready to build something great, Start building! 🚀