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 histories
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.git
- Fetch and checkout the latest panther-analysis tag from the panther-analysis GitHub releases page. (Replace v3.4.0 with the latest version.)
git fetch upstream
git checkout tags/$(git describe --tags `git rev-list --remotes=upstream/master --tags --max-count=1`) -b latest
- Switch to your main branch
git checkout main
- Merge the changes and history into your main branch
git merge latest
This issue occurs when the commit history is not synced from the panther-analysis repo.