Error 'fatal: refusing to merge unrelated histories' when running GitHub action sync-panther-analysis-from-upstream over private mirrored panther-analysis repo
Last updated: September 3, 2024
Issue
When trying to run GitHub action sync-panther-analysis-from-upstream over our private cloned/mirrored panther-analysis repo the following error occurs:
fatal: refusing to merge unrelated historiesResolution
To resolve this issue:
Check to see that you have merged the commit history from the panther-analysis repo in your commit history.
If you've rebased and bundled all commits from panther-analysis into a single commit, merging more than small changes won't work.
If you have rebased your merges from the panther-analysis repo:
Set panther-labs/panther-analysis as your upstream remote
git remote add upstream https://github.com/panther-labs/panther-analysis.gitFetch and checkout the latest panther-analysis tag from the panther-analysis GitHub releases page. (Replace v3.4.0 with the latest version.)
git fetch upstreamgit checkout tags/$(git describe --tags git rev-list --remotes=upstream/master --tags --max-count=1) -b latestSwitch to your main branch
git checkout mainMerge the changes and history into your main branch
git merge latest
Cause
This issue occurs when the commit history is not synced from the panther-analysis repo.