Welcome to the cloud side of Git 🌩️ —
this is where your local work becomes global, sharable, and team-ready. 💻🌍
If Git is your personal diary, then GitHub is your public library 📚 —
you can showcase your work, collaborate with others, and back up your projects securely.
- Visit https://github.com/
- Click Sign Up
- Enter:
- Username (unique handle)
- Password
- Verify your email and done ✅
Now you have your own developer identity online!
💡 Pro Tip: Choose a clean username — it becomes part of your public URL, like
https://github.com/maheshshukla1
Once logged in:
- Click “New Repository” (top-right ➕ icon)
- Give it a name, e.g.
my-first-git-project - Add a short description
- Choose Public or Private
- Uncheck “Initialize with README” if you already have one locally
- Click Create Repository
GitHub will show a page with setup instructions 👇
We’ll use those in the next step.
Now let’s connect your local project to GitHub’s cloud.
git remote add origin https://github.com/<username>/<repo-name>.gitgit remote add origin https://github.com/maheshshukla1/my-first-git-project.gitThis tells Git:
“Hey, that GitHub repo is now my origin — my home base online.”
git remote -vOutput:
origin https://github.com/maheshshukla1/my-first-git-project.git (fetch)
origin https://github.com/maheshshukla1/my-first-git-project.git (push)💡 Pro Tip:
You can have multiple remotes! e.g.
-
origin→ GitHub -
upstream→ Forked repo source
git push -u origin mainThis uploads your commits from local → GitHub.
The -u flag links your local branch with the remote one,
so next time you can simply do:
git pushYou just finished coding a login feature 💻
Let’s push it live:
git add .
git commit -m "Add login feature"
git push origin mainNow open your GitHub repo — boom 💥 your code’s there!
🔥 Pro Dev Tip: Always push small, tested commits — easier to debug and revert.
If you’re collaborating with others, your teammates may have pushed new commits.
Use git pull to sync your local codebase.
git pull origin mainThis does two things:
-
Downloads new commits
-
Merges them into your current branch
💡 Pro Tip:
If you want to avoid automatic merging, use git fetch instead (see below 👇).
git fetch only downloads changes from GitHub, but does not merge them automatically.
git fetch originThen you can inspect what changed:
git log origin/mainWhen you’re ready to merge:
git merge origin/main🧠 Think of it like this:
-
git fetch→ “Tell me what’s new.” -
git pull→ “Bring me the new stuff and merge it.”
Cloning is how you download a repo and start working instantly.
git clone https://github.com/<username>/<repo-name>.gitExample:
git clone https://github.com/maheshshukla1/GitHub-Guru.gitNow you’ve got a full copy with history, commits, and branches intact.
Let’s simulate a developer workflow 👇
# Step 1: Create local repo
git init my-portfolio
cd my-portfolio
# Step 2: Add and commit changes
git add .
git commit -m "Initial project setup"
# Step 3: Create GitHub repo and link
git remote add origin https://github.com/maheshshukla1/my-portfolio.git
# Step 4: Push to GitHub
git push -u origin main
# Step 5: Fetch and Pull updates
git fetch origin
git pull origin main✅ You’ve just set up a professional Git workflow like a real dev team!
| Command | Direction | Analogy |
|---|---|---|
git push |
Local → Remote | Upload your code |
git pull |
Remote → Local | Download + merge |
git fetch |
Remote → Local (no merge) | Preview changes |
git clone |
Remote → Local (full copy) | Download project starter |
-
Always
pullbefore youpush⚖️ -
Commit small & frequent changes
-
Use SSH instead of HTTPS for long-term projects
-
Keep
mainprotected — use branches for experiments -
Add
.gitignoreto skip unwanted files (like node_modules/)
If you’re tired of entering passwords, set up SSH keys 👇
- Generate SSH key:
ssh-keygen -t ed25519 -C "your_email@example.com"- Copy your key:
cat ~/.ssh/id_ed25519.pub-
Go to GitHub → Settings → SSH and GPG keys → Add New Key
-
Paste your key and save
-
Test it: ``
ssh -T git@github.com✅ You’re now connected securely without password prompts.
✅ You created a GitHub account
✅ You linked your local repo using git remote add origin
✅ You learned push, pull, fetch, and clone
✅ You can now collaborate globally like a pro 🌍
| Git Concept | Real-World Example |
|---|---|
| Local Repo | Your Laptop |
| Remote Repo | GitHub Cloud |
push |
Upload homework |
pull |
Download new updates |
fetch |
Peek before downloading |
clone |
Copy entire project folder |
You’ll master:
rebase,stash,reset, andrevert— the ultimate developer tools to fix, rewrite, and clean history like a pro.
👉 Continue → 05-Advanced-Git
✍️ Written with ❤️ by Mahesh Shukla — connecting code across the cloud, one push at a time. ☁️