Skip to content
ohsudo, Home

Articles

CI/CD

Git and CI/CD problems explained: rejected pushes, dubious ownership and .gitignore, with the commands that fix them safely.

would be overwritten by merge
CI/CD

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.

Beginner · 3 min read

src refspec
CI/CD

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.

Beginner · 4 min read

This job is stuck
CI/CD

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.

Beginner · 5 min read

refusing to merge unrelated histories
CI/CD

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.

Beginner · 4 min read

Resource not accessible
CI/CD

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.

Intermediate · 4 min read

.gitignore not working
CI/CD

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

Beginner · 4 min read

fatal: detected dubious ownership in repository
CI/CD

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.

Beginner · 3 min read

! [rejected] main -> main (fetch first)
CI/CD

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.

Beginner · 4 min read