jenkinsci / jenkinsci/git-plugin

[JENKINS-70463] Lightweight checkout: commitId as branch name does not work when expanded

Open
#3,778 0 comments 1 reaction 0 assignees View on GitHub
component:git-plugin imported-jira-issue pipeline priority:minor resolution:unresolved
Dominant language
Java
Stars
694
Forks
1.1k
Avg merge
1h 29m
Merged PRs (30d)
3

Description

The Git plugin should now be able to expand environment variables and use them for the checkouts, such as the branch specifier. This works completely fine when specifying a branch name. It also worked fine when entering a commit ID manually. 

However, it fails when I combine the two and add the commit ID as a parameter, which is then used for the branch (see attached screenshot). The plugin will treat it as a regular branch name and fails to do the checkout.

stderr: fatal: couldn't find remote ref refs/heads/62f7ad718b0d427b7fd0cb0fe15a615308c41d92

My workaround for now is to use the branch name instead of the commit hash.

---
Originally reported by vogtmh, imported from: Lightweight checkout: commitId as branch name does not work when expanded


  • status: Open
  • priority: Minor
  • component(s): git-plugin
  • label(s): pipeline
  • resolution: Unresolved
  • votes: 0
  • watchers: 3
  • imported: 2025-12-02

Raw content of original issue

The Git plugin should now be able to expand environment variables and use them for the checkouts, such as the branch specifier. This works completely fine when specifying a branch name. It also worked fine when entering a commit ID manually. 

However, it fails when I combine the two and add the commit ID as a parameter, which is then used for the branch (see attached screenshot). The plugin will treat it as a regular branch name and fails to do the checkout.

stderr: fatal: couldn't find remote ref refs/heads/62f7ad718b0d427b7fd0cb0fe15a615308c41d92
My workaround for now is to use the branch name instead of the commit hash.

  • environment: Jenkins 2.375.2, Git Plugin 5.0.0

1 attachment

- [Capture.PNG](https://issues.jenkins.io/secure/attachment/59862/Capture.PNG)
> ![Capture.PNG](https://issues.jenkins.io/secure/attachment/59862/Capture.PNG)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.