Welcome to your journey from GitHub beginner to pro. This repository is a practical guide to Git + GitHub workflows, collaboration, automation, and common troubleshooting—so you can confidently handle real-world GitHub projects.
- About
- Features
- Getting Started
- Git Basics (Global Username & Email)
- Login to GitHub using Git (Authentication)
- Working with GitHub
- Authentication: HTTPS, SSH, and Verified Commits (GPG)
- Common Git & GitHub Errors (Fix Guide)
- Advanced Features
- Best Practices
- Resources
- License
This repository is a hands-on guide to mastering GitHub—from creating your first repository to leveraging automation, collaboration, and security features.
If you’re ever stuck with Git/GitHub errors (authentication, push/pull issues, upstream setup, SSH problems, verified commits), check the Troubleshooting section below.
| Feature | Description | Status |
|---|---|---|
| Commit & Push | Save and upload code to GitHub | ✅ |
| Branching & Merging | Develop features safely with branches | ✅ |
| Issues & Pull Requests | Track tasks and propose code changes | ✅ |
| Workflows & CI/CD | Automate testing and deployment | ✅ |
| GitHub Pages | Host project documentation or websites | ✅ |
| Security & Dependabot | Automated vulnerability alerts | ✅ |
| Project Boards | Organize and plan project tasks | ✅ |
| Wiki | Collaborative project documentation | ✅ |
| Actions Marketplace | Use ready-made automation actions | ✅ |
git clone https://github.com/your-username/your-repo.git
cd your-repoecho "# Hello, GitHub!" > hello.md
git add hello.md
git commit -m "Add hello.md"
git pushgit checkout -b feature/my-feature- Push your branch:
git push -u origin feature/my-feature - Go to your repo on GitHub, click "Compare & pull request".
These settings decide who Git says you are in commits (author name/email).
git config --global user.name "Your Name"
git config --global user.email "you@example.com"git config --global --get user.name
git config --global --get user.email
# or list everything:
git config --global --listRun inside the repo folder (no --global):
git config user.name "Your Name"
git config user.email "you@example.com"Git itself doesn’t have a login command. To “login” for Git operations (clone/push/pull), you authenticate using one of the methods below.
When you push/pull over HTTPS, GitHub requires a token (PAT), not your account password.
- Check remote:
git remote -v
# https://github.com/<user>/<repo>.git- Do a Git operation:
git pull
# or
git push- Enter:
- Username: your GitHub username
- Password: a GitHub Personal Access Token (PAT)
Optional (Linux): cache credentials:
git config --global credential.helper storeSSH avoids repeated token prompts and is the standard for dev workflows.
- Generate a key (ED25519 recommended):
ssh-keygen -t ed25519 -C "you@example.com"- Add key to ssh-agent:
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519- Add public key to GitHub:
cat ~/.ssh/id_ed25519.pubGitHub → Settings → SSH and GPG keys → New SSH key
- Test login:
ssh -T git@github.com- Switch your repo remote to SSH:
git remote set-url origin git@github.com:<user>/<repo>.gitgh auth login
gh auth status- Issues: Report bugs, request features, and discuss ideas.
- Pull Requests: Propose changes and get feedback.
- Fork & Star: Copy repositories and bookmark your favorites.
- Watch: Get notified about project activity.
- Labels & Milestones: Organize issues and PRs.
When Git asks for a password, use a Personal Access Token (PAT) instead of your GitHub password.
Helpful checks:
git remote -v
git config --global credential.helperYou can follow a step-by-step SSH + GPG guide here:
Typical SSH flow:
ssh-keygen -t ed25519 -C "you@example.com"
ssh -T git@github.comIf you want the “Verified” badge on GitHub commits, configure commit signing.
Common config:
git config --global commit.gpgsign true
git config --global user.signingkey <YOUR_KEY_ID>Cause: Wrong credentials, password used instead of token, or expired token.
Fix: Use a PAT for HTTPS, or switch to SSH.
Quick check:
git remote -vCause: SSH key not added, wrong key used, or not uploaded to GitHub.
Fix:
ssh -T git@github.com
ssh-add -lIf needed:
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519Cause: Wrong URL, repo renamed, no access, or wrong remote.
Fix:
git remote -v
git remote set-url origin <correct-url>A. Remote has new commits
git pull --rebase origin main
git pushB. Upstream not set
git push -u origin <branch-name>Fix:
git push -u origin <branch-name>Recommended:
git pull --rebaseOptional: set default behavior:
git config --global pull.rebase true
# or:
git config --global pull.ff onlyUndo last commit but keep changes staged:
git reset --soft HEAD~1Undo last commit and unstage changes:
git reset HEAD~1Discard local changes (danger):
git reset --hardRecover lost commits:
git reflogAutomate workflows like testing, building, or deploying.
# .github/workflows/ci.yml
name: CI
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test- Enable Dependabot for automatic dependency updates.
- Add a
.github/CODEOWNERSfile for required reviews. - Use branch protection rules.
- Never commit secrets (use GitHub Secrets for Actions).
Host static websites or documentation directly from your repository.
Use GitHub Projects to visualize and manage work.
- Use clear commit messages (
git commit -m "Add user authentication") - Add a
CONTRIBUTING.mdif you want external contributions - Protect your default branch and require PR reviews
- Use
.gitignoreto avoid committing junk files - Do not commit secrets (tokens, private keys,
.envfiles)
- GitHub Docs: https://docs.github.com/
- Pro Git Book: https://git-scm.com/book/en/v2
- Git Cheat Sheet: https://education.github.com/git-cheat-sheet-education.pdf
- SSH + GPG Guide (companion repo): https://github.com/Arannamoy-Mondal/Git-Set-Up-With-SSH
This project is licensed under the Apache License 2.0. See LICENSE for details.