Skip to content
ohsudo, Home

Learning path

Git for everyday work

Everyday commands, then pushing, pulling, and working with a team and CI.

3 stages · 12 steps

  1. Stage 1

    Everyday commands

    The commands, a place to practise them, and what to keep out of the repository.

    1. 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. 2

      Tool

      Linux Terminal Playground

      Practise git safely in the Terminal Playground.

    3. 3

      Tool

      .gitignore & .dockerignore Generator

      Ignore files for your stack, in one click.

    4. 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.

  2. Stage 2

    Pushing and pulling

    Your work and the server's, and what to do when they disagree.

    1. 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.

    2. 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.

    3. 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.

    4. 8

      Article

      Git "fatal: refusing to merge unrelated histories": when the flag is safe, and when it isn't

      Fix Git "fatal: refusing to merge unrelated histories": why it happens, how to use --allow-unrelated-histories safely, and how to spot a wrong remote or shallow clone.

  3. Stage 3

    Teams and CI

    Shared folders, signed commits, and pipelines.

    1. 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.

    2. 10

      Tool

      CI/CD Pipeline Generator

      GitHub Actions and GitLab CI pipelines: build, test, push images and deploy.

    3. 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.

    4. 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.

Your progress is saved in this browser only, never sent anywhere. Clearing the browser data clears it too.

All learning paths →