GitHub — Remote Repository and Collaboration
What is GitHub?
GitHub is the world's largest code hosting platform — a cloud service that stores your Git repositories online. Built on top of Git, GitHub adds collaboration features: pull requests, code review, project boards, CI/CD pipelines, and more. Owned by Microsoft since 2018.
Git ≠ GitHub. Git is the version control tool (local). GitHub is the cloud service (remote). You can use Git without GitHub, but most teams use both together.
Why Use GitHub?
GitHub is where the world's software lives. Over 100 million developers use it. Every .NET open-source project (including .NET itself, ASP.NET Core, EF Core) is on GitHub. Employers look at your GitHub profile when hiring.
Where is it Used?
| Scenario | Use |
|---|---|
| Store and backup code | ✅ Push local repo to GitHub |
| Team collaboration | ✅ Multiple developers, pull requests |
| CI/CD automation | ✅ GitHub Actions — build/test/deploy |
| Open source | ✅ Share code with the world |
| Portfolio | ✅ Employers see your projects |
| Issue tracking | ✅ Bugs and feature requests |
Key Benefits
- Free — unlimited public and private repos for individuals
- GitHub Actions — free CI/CD, runs
dotnet buildanddotnet testautomatically - Pull Requests — structured code review before merging
- Branch protection — prevent bad code reaching main branch
- Community — contribute to open source, learn from real projects
- Portfolio — your GitHub = your public developer resume
GitHub is essential for team collaboration, CI/CD, and showing your work to employers.
Setup
# Create account: github.com
# Setup SSH (recommended over HTTPS)
ssh-keygen -t ed25519 -C "your@email.com"
cat ~/.ssh/id_ed25519.pub # copy this to GitHub → Settings → SSH Keys
# Test
ssh -T git@github.com
# Hi username! You've successfully authenticated.
Push Your .NET Project
# 1. Create repo on GitHub (no README, no .gitignore)
# 2. Connect and push
git remote add origin git@github.com:username/SchoolManagementSystem.git
git branch -M main
git push -u origin main
# Daily workflow after setup
git add .
git commit -m "Add exam marks endpoint"
git push # pushes to origin/main
Clone a Repo
git clone git@github.com:NexCoding-07/school-management-dotnet.git
cd SchoolManagementSystem
dotnet restore # restore NuGet packages
dotnet run # run the project
Pull Requests Workflow
1. Create feature branch
git switch -c feature/fee-payment-api
2. Code + commit
git add .
git commit -m "Add fee payment endpoints"
3. Push branch
git push origin feature/fee-payment-api
4. Open PR on GitHub
→ GitHub shows "Compare & pull request" button
→ Title: "Add fee payment API endpoints"
→ Description: what changed, why, how to test
5. Code review
→ Reviewer comments on specific lines
→ Author pushes more commits to address comments
6. Merge → PR closed → branch deleted
GitHub Actions — CI/CD for .NET
Create .github/workflows/ci.yml:
name: School Management CI
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET 8
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore
run: dotnet restore
- name: Build
run: dotnet build --no-restore -c Release
- name: Test
run: dotnet test --no-build -c Release --verbosity normal
- name: Publish (main branch only)
if: github.ref == 'refs/heads/main'
run: dotnet publish -c Release -o ./publish
Every push → builds and tests automatically. PR can't merge if CI fails.
Protect main Branch
Repository → Settings → Branches → Add rule
Pattern: main
✅ Require pull request before merging
✅ Require 1 approving review
✅ Require status checks (CI must pass)
✅ Restrict pushes (no direct push to main)
GitHub Features Every Developer Uses
| Feature | Purpose |
|---|---|
| Issues | Track bugs, feature requests |
| Projects | Kanban board / sprint planning |
| Actions | CI/CD pipelines |
| Releases | Tag versions (v1.0.0, v1.1.0) |
| Code Review | Review PR diffs line-by-line |
| Insights | Contribution graphs, traffic |
GitHub Interview Questions
Q1: What is a Pull Request and why is it used?
A PR proposes merging a branch into another.
Enables: code review, discussion, CI checks before merge.
Best practice: never push directly to main — always use PRs.
Q2: What is GitHub Actions?
CI/CD platform built into GitHub.
On push/PR: automatically build, test, deploy your .NET app.
Runs on Linux/Windows/Mac runners.
Free for public repos; 2000 min/month for private.
Q3: What is branch protection and why use it?
Prevents direct pushes to main.
Forces PRs + code review + CI passing before merge.
Prevents accidental bad code from reaching production.
Q4: Git vs GitHub — what's the difference?
Git → version control tool (local, runs on your machine)
GitHub → hosting service for Git repos (remote, cloud, collaboration)
Others: GitLab, Bitbucket — same concept, different platforms
Use ChatGPT, Claude, or Copilot to go deeper on GitHub for .NET developers. Try these prompts:
"What is the difference between Git and GitHub?""How do I set up GitHub Actions to automatically build and test my .NET project?""What is a Pull Request and how does the code review process work?""Quiz me on GitHub — 5 questions about branching, PRs, and CI/CD"
💡 Tip: After reading this article, paste your own code into AI and ask "What could go wrong here and why?" — fastest way to find edge cases and deepen understanding.