Learning path
Git for everyday work
Everyday commands, then pushing, pulling, and working with a team and CI.
3 stages · 12 steps
Stage 1
Everyday commands
The commands, a place to practise them, and what to keep out of the repository.
- 1
Cheat sheet
Git Cheat Sheet
The Git commands you use every day, and how to undo almost anything: commits, staging, branches, merges, stash, remotes and recovering lost work
- 2
- 3
- 4
Article
.gitignore not working: why Git still tracks the file, and how to fix it
.gitignore is ignored because the file is already tracked, the pattern is wrong or the file has the wrong encoding. Find the cause with git check-ignore -v.
- 1
Stage 2
Pushing and pulling
Your work and the server's, and what to do when they disagree.
- 5
Article
Git "error: src refspec main does not match any": commit first, or use the right branch name
Fix Git "error: src refspec main does not match any" on push: you have no commits yet, or your branch is called master. Check with git branch, then commit or rename it.
- 6
Article
Git "! [rejected] main -> main (fetch first)": why the push failed and how to fix it safely
Fix git push "rejected (fetch first)" and "non-fast-forward": pull with rebase or merge, use --force-with-lease instead of --force, and handle protected branches.
- 7
Article
Git "Your local changes would be overwritten by merge": keep them, or throw them away
Fix git "Your local changes to the following files would be overwritten by merge" or checkout: commit, stash, or discard them, plus untracked files and servers.
- 5
Stage 3
Teams and CI
Shared folders, signed commits, and pipelines.
- 9
Article
Git "fatal: detected dubious ownership in repository": fix it without turning the check off
Fix Git "detected dubious ownership in repository": run Git as the owner, fix the ownership, or trust one path with safe.directory, on servers, Docker and CI.
- 10
Tool
CI/CD Pipeline Generator
GitHub Actions and GitLab CI pipelines: build, test, push images and deploy.
- 11
Article
GitHub Actions "Resource not accessible by integration": give the token the right permission
Fix GitHub Actions "Resource not accessible by integration" (HTTP 403): add the right permissions to GITHUB_TOKEN, and handle fork pull requests and Dependabot safely.
- 12
Article
GitLab CI "This job is stuck": why no runner picks it up, and how to fix it
Fix GitLab CI "This job is stuck because you don't have any active runners": match the job's tags, enable shared runners, check runner status and protected branches.
- 9
Your progress is saved in this browser only, never sent anywhere. Clearing the browser data clears it too.