Skip to content
ohsudo, Home

Tags

#git

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

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

xcrun: error
macOS

macOS "xcrun: error: invalid active developer path": fix it after a macOS update

Fix macOS "xcrun: error: invalid active developer path" when git, make or brew stop working: reinstall the Command Line Tools, or point xcode-select to Xcode.

Beginner · 2 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

SSL certificate problem: unable to get local issuer certificate
Security

"SSL certificate problem: unable to get local issuer certificate": fix the chain, not the check

Fix "unable to get local issuer certificate" in curl, git, pip, npm and Docker: find the broken link with openssl, then fix the server chain or add the missing CA.

Intermediate · 4 min read