checkout: Error while checking out: "fatal: reference is not a tree"
I’m sorry if this is not the right place for this issue, but it’s where it looked most appropriate to me.
When re-triggering a workflow for the PR #620 in the Jaeger Operator, the checkout step fails with:
git checkout --progress --force 76143e9bd1c40fc0b71fd45a987c80b9db0a9096
##[error]fatal: reference is not a tree: 76143e9bd1c40fc0b71fd45a987c80b9db0a9096
Removed matchers: 'checkout-git'
##[remove-matcher owner=checkout-git]
##[error]Git checkout failed with exit code: 128
##[error]Exit code 1 returned from process: file name '/home/runner/runners/2.157.0/bin/Runner.PluginHost', arguments 'action "GitHub.Runner.Plugins.Repository.CheckoutTask, Runner.Plugins"'.
I can confirm that the commit exists in the fork, so, I’m not sure what the action is complaining about:
$ git remote add rubenvp8510 https://github.com/rubenvp8510/jaeger-operator
$ git fetch rubenvp8510
remote: Enumerating objects: 44, done.
remote: Counting objects: 100% (44/44), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 53 (delta 41), reused 43 (delta 41), pack-reused 9
Unpacking objects: 100% (53/53), done.
From https://github.com/rubenvp8510/jaeger-operator
* [new branch] Issue-304 -> rubenvp8510/Issue-304
* [new branch] Issue-399 -> rubenvp8510/Issue-399
* [new branch] Issue-442 -> rubenvp8510/Issue-442
* [new branch] Issue-443 -> rubenvp8510/Issue-443
* [new branch] Issue-557 -> rubenvp8510/Issue-557
* [new branch] Issue-568 -> rubenvp8510/Issue-568
* [new branch] Issue-598 -> rubenvp8510/Issue-598
* [new branch] master -> rubenvp8510/master
* [new branch] revert-391-streame2e -> rubenvp8510/revert-391-streame2e
* [new branch] token-propagation -> rubenvp8510/token-propagation
$ git checkout --progress --force 76143e9bd1c40fc0b71fd45a987c80b9db0a9096
Note: checking out '76143e9bd1c40fc0b71fd45a987c80b9db0a9096'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b <new-branch-name>
HEAD is now at 76143e9b add resource limits for spark dependencies cronjob
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 28
- Comments: 27 (9 by maintainers)
Links to this issue
Commits related to this issue
- Fix CI (see actions/checkout#23)? — committed to skirpichev/diofant by skirpichev 4 years ago
- use checkout@v2 to avoid fatal: reference is not a tree (#6386) "fatal: reference is not a tree" is a known issue in actions/checkout#23 and fixed in checkout@v2, update checkout used in GitHub actio... — committed to apache/pulsar by yjshen 4 years ago
- Fix CI (see actions/checkout#23) — committed to skirpichev/diofant by skirpichev 4 years ago
- Fix CI (see actions/checkout#23) — committed to skirpichev/diofant by skirpichev 4 years ago
- Fix CI (see actions/checkout#23) — committed to skirpichev/diofant by skirpichev 4 years ago
- Fix ci reference error *Motivation* "fatal: reference is not a tree" is a known issue in actions/checkout#23 and fixed in checkout@v2. — committed to zymap/bookkeeper by zymap 4 years ago
- Update github checkout action version Facing the issues mentioned at https://github.com/actions/checkout/issues/23 Which is solved in the new version — committed to zabil/taiko by zabil 4 years ago
- ci: use checkout@v2 to work around https://github.com/actions/checkout/issues/23 We'll often get errors in the CI build job like: Resolving deltas: 100% (14917/14917), done. From https://github.com/... — committed to dcbw/ovn-kubernetes by dcbw 4 years ago
- Merge pull request #11285 from hpidcock/fix-actions https://github.com/juju/juju/pull/11285 ## Description of change Move to using actions/checkout@v2 to fix issue https://github.com/actions/checko... — committed to juju/juju by jujubot 4 years ago
- Update github actions checkout CI broke due to an upstream bug, solution is updating the library: See https://github.com/actions/checkout/issues/23 — committed to est31/cargo-udeps by est31 4 years ago
- chore(ci): bump checkout action to v2 This should fix the checkout problems we're facing. Related discussion: https://github.com/actions/checkout/issues/23 — committed to aslushnikov/playwright by aslushnikov 4 years ago
- chore(ci): bump checkout action to v2 (#1263) This should fix the checkout problems we're facing. Related discussion: https://github.com/actions/checkout/issues/23 — committed to microsoft/playwright by aslushnikov 4 years ago
- Merge form pulsar master (#3) * [Issue 5904]Support `unload` all partitions of a partitioned topic (#6187) Fixes #5904 ### Motivation Pulsar supports unload a non-partitioned-topic or a parti... — committed to kaynewu/pulsar by kaynewu 4 years ago
- [#542] Bump checkout action to v2 Based on thee discussion [here](https://github.com/actions/checkout/issues/23#issuecomment-572688577) it seems `actions/checkout@v2` has solved this issue. — committed to erlang-ls/erlang_ls by jfacorro 4 years ago
- common: bump GHA checkout action to v2 It fixes the following bug: https://github.com/actions/checkout/issues/23 occurring recently in PMDK GHA builds. — committed to ldorau/pmdk by ldorau 4 years ago
- BUILD: Upgrade to actions/checkout@v2 in GitHub Actions. Will hopefully resolve issue: https://github.com/actions/checkout/issues/23 — committed to AlgebraicJulia/Catlab.jl by epatters 4 years ago
- build: use checkout@v2, not v1, as this allows manual re-running of tests https://github.com/actions/checkout/issues/23 — committed to feywind/synthtool by feywind 4 years ago
- build: use checkout@v2, not v1, as this allows manual re-running of tests (#451) https://github.com/actions/checkout/issues/23 — committed to googleapis/synthtool by feywind 4 years ago
- build: use checkout@v2, not v1, as this allows manual re-running of tests (#451) https://github.com/googleapis/synthtool/commit/7e98e1609c91082f4eeb63b530c6468aefd18cfd commit 7e98e1609c91082f4eeb63b5... — committed to googleapis/nodejs-video-intelligence by yoshi-automation 4 years ago
- build: use checkout@v2, not v1, as this allows manual re-running of tests (#451) https://github.com/googleapis/synthtool/commit/7e98e1609c91082f4eeb63b530c6468aefd18cfd commit 7e98e1609c91082f4eeb63b5... — committed to googleapis/nodejs-video-intelligence by yoshi-automation 4 years ago
@soluchok Apologies, we’re still working on a fix for this! I was on vacation, so I’ll hopefully get one in soon and update this ticket accordingly.
Looks like the wrong REF only happened when we try to re-run a failed workflow.
@iheanyi thread: https://twitter.com/Runspired/status/1191746539372212224
Roughly I believe the root of the issue is a race condition between when @actions/checkout triggers the checkout and when the merge commit has been created in the repo.
If the checkout occurs before the commit is created, then checkout results in creating the merge commit itself which results in a different SHA than the SHA that is used for
$GITHUB_SHA
For some reason this condition is far more common when it is a new commit to an open PR.
I suspect roughly the flow behind the scenes is (in order of A -> G)
success
failure
This seems to be it in my case - made a dummy commit and now the workflow is running fine. Using Amplify though.
The last comment is from half a year ago so I’d like to update and say this issue is indeed still happening. I can’t see why it is closed, because the “145 hidden items - Load more items” button doesn’t work, but if it was fix, looks like the fix is incomplete or there are multiple ways to trigger this issue.
Ran into this issue as I’ve got the same error in my github action.
For me it was resolved today by running
git pull --all
in the action shell script before doing anything else with the git repository.Reasoning: seems like github creates a shallow-depth git repo by default as the
git branch -a
command only listed themaster
branch (plus theremotes/origin/master
one) while the repo had at least one other branch. Only after runninggit pull --all
as part of the action code did that other branch show up and did my other git commands start to behave as expected.HTH.
Action YML:
shell script in repo root:
NOTE: I suspect the shallow repo copy as any
git checkout
would fail, even when specifying commit hashes instead of branch names, and that also when the commit was a close predecessor of the HEAD commit – only spot checked this with a distance of about 5, had an idea and moved on that: that’s where I came up with thegit pull --all
which did fix the problem for me at least.Our build is still affected by this issue, and v2 version doesn’t seem to do a difference. Similar to what @localheinz commented, we also use
fetch-depth: 0
configuration which could be the common denominator with our issues.@wl2776 this repo is for GitHub Actions. If you are seeing bugs in various Jenkins plugins please report those there.
@sebdau sorry but that is the Azure DevOps product. This repo is for GitHub Actions 😦
I’m seeing this error, too. Our build is not yet using YAML but classic UI-style release pipe. According to the logs, this is still using V1 git task. Is there a way to change the task version?
https://msazure.visualstudio.com/One/_build/results?buildId=28043911&view=logs&j=92a4755a-6173-591e-5c07-8dbe1165e937&t=ead66276-ec45-5be0-fa6c-361c94a3aa0c&l=5
Thx, Seb