Open
Description
Issue Description
Summary
Following the update of the ubuntu24/20250710.1
runner image—which included upgrading Git from 2.49.0 to 2.50.1—using actions/checkout@v4
with fetch-depth: 0
no longer sets up the origin/HEAD
symbolic reference. As a result, workflows that rely on origin/HEAD..HEAD
as a valid revision range are now broken.
Steps to Reproduce
- Use
actions/checkout@v4
withfetch-depth: 0
on anubuntu-latest
runner. - Execute a command referencing
origin/HEAD
(e.g.,git diff origin/HEAD..HEAD
). - Observe the following error:
fatal: ambiguous argument 'origin/HEAD..HEAD': unknown revision or path not in the working tree
Expected Behavior
- The
origin/HEAD
symbolic ref should automatically point to the default branch, mirroring the behavior of a standardgit clone
.
Actual Behavior
- The
origin/HEAD
reference is missing, causing failures in tools and scripts that rely on it (for example,pre-commit
when invoked with--from-ref origin/HEAD --to-ref HEAD
).
Environment
- Runner:
ubuntu-latest
(ubuntu24/20250710.1
) - Git version: 2.50.1 (previously 2.49.0)
- Checkout version:
actions/checkout@v4
Example Workflow
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: git diff origin/HEAD..HEAD
Workaround
Adding the following step immediately after checkout restores the expected behavior:
- name: Set up git references
run: git remote set-head origin --auto
Root Cause
Git 2.50 introduced changes to default branch handling during clone operations, which appears to affect how origin/HEAD
is configured.
Request
Please update actions/checkout
to ensure that origin/HEAD
is correctly set when fetch-depth: 0
is used, maintaining compatibility with workflows that depend on this reference.
Metadata
Metadata
Assignees
Labels
No labels