GitHub Mastery
GitHub is more than just a host; it's a collaboration platform. This skill covers the mechanics of taking a local repository live and working with others.
Remote Configuration
- Connect:
git remote add origin <url> - Verify:
git remote -v - Push:
git push -u origin main
Authentication (SSH)
Using SSH keys is more secure and convenient than HTTPS with Personal Access Tokens.
- Generate:
ssh-keygen -t ed25519 -C "your_email@example.com" - Add: Add the
.pubkey to your GitHub account settings. - Test:
ssh -T git@github.com
GitHub CLI (gh)
The official CLI tool for managing GitHub from your terminal.
- Create Repo:
gh repo create <name> --public --source=. --remote=origin - Manage PRs:
gh pr create,gh pr checkout <id>,gh pr merge
Pull Request Workflow
- Branch: Create a feature branch.
- Push: Push to GitHub.
- Draft: Create a Draft PR if the work is in progress.
- Review: Address feedback and push updates.
- Merge: Squashing or rebasing is preferred for a clean
mainhistory.
Best Practices
- README: Every repo needs a professional README.
- LICENSE: Choose an appropriate license (MIT, Apache 2.0).
- Security: Never commit secrets or API keys (use
.gitignore).