🚀 Git & GitHub Beginner Guide (2026)

Learn version control step-by-step — perfect for students & beginners 👨‍💻


📌 What is Git?

Git is a tool that helps you: - Track changes in your code 📊
- Go back to previous versions ⏪
- Work safely without losing data

👉 Think of Git as a save history system for your code.


🌐 What is GitHub?

GitHub is a platform where: - You store your code online ☁️
- Share projects 🤝
- Collaborate with others 🌍


⚙️ Step 1: Install Git

Download Git: https://git-scm.com/downloads

Check installation:

git --version

🛠️ Step 2: Configure Git

git config --global user.name "Your Name"
git config --global user.email "your@email.com"

📁 Step 3: Initialize Repository

cd your-project-folder
git init

📦 Step 4: Add Files

Add all files:

git add .

Add specific file:

git add file.txt

💾 Step 5: Commit Changes

git commit -m "Initial commit"

🔗 Step 6: Connect to GitHub

git remote add origin https://github.com/username/repo.git

🚀 Step 7: Push Code

git branch -M main
git push -u origin main

🔄 Common Commands

git status      # Check changes
git log         # View history
git pull        # Get updates
git clone URL   # Download repo

⚠️ Common Errors & Solutions

❌ Permission denied (publickey)

ssh-keygen -t ed25519 -C "your@email.com"

👉 Add SSH key to GitHub


❌ Authentication failed

👉 Use Personal Access Token instead of password
👉 Or switch to SSH authentication


❌ Nothing to commit

git add .
git commit -m "message"

💡 Pro Tips

  • Commit frequently ✔️
  • Write clear commit messages 🧠
  • Always pull before push 🔄
  • Never upload sensitive data 🚫

🎯 Conclusion

Now you know: - Git basics
- How to track code
- How to push to GitHub

🔥 Practice daily and become pro 🚀