Skip to content
ohsudo, Home

Tags

#github

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

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

! [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