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 histories​​​​​

Resolution

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:

  1. Set panther-labs/panther-analysis as your upstream remote
    git remote add upstream https://github.com/panther-labs/panther-analysis.git

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

  3. Switch to your main branch
    git checkout main

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

 

See also:📄 How do I resolve merge conflicts and failed syncs when using the GitHub Action sync-panther-analysis-from-upstream?