CI Git reference not a tree
If the CI-detected change is
git commit --amend or squash and force push over previous commits, the CI run may fail with a message like:
fatal: reference is not a tree: <commit id> The command "git checkout -qf <commit id>" failed and exited with 128 during .
Different CI systems have distinct default Git depth. Checking out all commits takes too much time, while too shallow can falsely fail on force push.
We would suggest not specifying the Git clone depth, thereby using the CI system default, unless the repo is very large and Git clone is taking too long. If manually specifying Git depth, the depth must be larger than the number of Git commits your team would ever squash and force push (overwriting prior commits).
For example, in GitHub Actions:
- uses: actions/checkout with: fetch-depth: 5