1. Introduction
GitHub isn’t just a storage place for code—it’s the backbone of modern software development.
From version control and open-source contributions to team collaboration and deployment, GitHub is the developer’s command center.
If you’ve ever tried pushing your first project and got errors like “fatal: remote origin already exists” or “authentication failed”, this guide is for you.
In this blog, you’ll learn:
How to upload your project step by step.
How to deploy your project (static or dynamic).
How to solve the most common Git/GitHub issues.
2. Prerequisites
Before starting, ensure you have the following:
✅ Git Installed → Run in terminal:
git --version✅ GitHub Account → Sign up here.
✅ Project Files Ready → Your local project folder.
Checklist:
Git installed
GitHub account created
Project files ready
3. Step 1: Initialize Git in Your Project
Navigate to your project folder:
cd path/to/your/projectRun the following commands:
git init
git add .
git commit -m "Initial commit"Command Breakdown:
git init→ Creates a new local repository inside your project.git add .→ Stages all files in the current directory.git commit -m "Initial commit"→ Saves a snapshot of your code with a commit message.
4. Step 2: Create a Repository on GitHub
Go to GitHub Repositories.
Click New Repository.
Enter:
Repository name (e.g.,
my-first-project).Optional description.
Visibility → Public or Private.
Uncheck “Initialize with README” if you already committed locally.
Click Create Repository.
5. Step 3: Link Local Repo with GitHub
Now connect your local repo to GitHub:
git remote add origin https://github.com/username/repo.git
git branch -M main
git push -u origin mainExplanation:
git remote add origin <URL>→ Links your local repo to the GitHub repo.git branch -M main→ Renames your default branch to main.git push -u origin main→ Uploads your project to GitHub.
6. Step 4: Deploy Projects from GitHub
Option A: Deploy Static Sites (GitHub Pages)
Go to Repo → Settings → Pages.
Under Source, select:
Branch:
mainFolder:
/ (root)
Save.
Access your project at:
https://username.github.io/repo-name/
Option B: Deploy Dynamic Apps (Using GitHub Actions)
If you’re deploying Node.js, Python, or React apps, GitHub Actions can automate builds & deployments.
Example: Node.js Workflow (.github/workflows/deploy.yml)
name: Node.js CI/CD
on:
push:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- run: npm install
- run: npm run build
- run: npm testThis runs automatically every time you push code to main.
7. Common Issues & Their Solutions
🔹 Error 1: fatal: remote origin already exists
Cause: You already linked a remote.
Fix:
git remote remove origin
git remote add origin https://github.com/username/repo.git🔹 Error 2: failed to push some refs
Cause: Branch mismatch between local and remote.
Fix:
git pull origin main --rebase
git push origin main🔹 Error 3: Authentication Failed (Token Issue)
Cause: GitHub removed password-based authentication.
Fix: Use Personal Access Token (PAT).
Go to GitHub → Settings → Developer Settings → Tokens.
Generate a token with
repopermissions.Push with token:
git push https://<TOKEN>@github.com/username/repo.git🔹 Error 4: Large File Size Error
Cause: GitHub blocks files >100MB.
Fix: Use Git LFS (Large File Storage).
git lfs install
git lfs track "*.mp4"
git add .gitattributes
git add .
git commit -m "Add large file support"
git push origin main8. Best Practices
✅ Add
.gitignoreto exclude unwanted files (e.g.,node_modules,.env,dist/).✅ Write clear commit messages:
git commit -m "Fix: updated login form validation"✅ Use branches:
feature/signupbugfix/navbar
✅ Always add a
README.md→ explain setup & usage.
9. Interactive Section: Hands-On Mini Task
Try this yourself:
Create a sample project (
hello-world).Upload it to GitHub following the steps above.
Deploy with GitHub Pages.
Share your repo link in the comments!
10. Conclusion
Summary:
Initialize Git → Create Repo → Link → Push → Deploy → Troubleshoot.
Common issues like remote errors, auth failures, and large files can be fixed easily.
Drop your GitHub profile link in the comments so others can connect!

