jenkinsci / jenkinsci/git-plugin

[JENKINS-43818] Git fetch fails when "Branch Specifier" uses a parameter in new version of the Git plugin

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

Description

In a pipeline job from a git repository where the "Branch Specifier" is given as a parameter, I started getting the following failure after updating the git plugin.

```
hudson.plugins.git.GitException: Command "git fetch --tags --progress origin +refs/heads/$\{GITREF}:refs/remotes/origin/$\{GITREF} --prune" returned status code 128:
stdout:
stderr: fatal: Couldn't find remote ref refs/heads/$\{GITREF}

        at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1799)
        at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1525)
        at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:65)
        at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:316)
        at jenkins.plugins.git.GitSCMFileSystem$BuilderImpl.build(GitSCMFileSystem.java:304)
        at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:196)
        at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:172)
        at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:99)
        at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:59)
        at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:232)
        at hudson.model.ResourceController.execute(ResourceController.java:98)
        at hudson.model.Executor.run(Executor.java:404)
Finished: FAILURE

```

I have tested all released version of the git plugin from 3.0.1 to 3.2.0 and the failure seems to have appeared in 3.0.2.

I don't know if it is relevant but with the Git plugin version 3.0.1, I see this at the beginning of the log:

Lightweight checkout support not available, falling back to full checkout.

 

---
Originally reported by gd13, imported from: Git fetch fails when "Branch Specifier" uses a parameter in new version of the Git plugin


  • status: Open
  • priority: Major
  • component(s): git-plugin
  • label(s): feature-improvement, regression
  • resolution: Unresolved
  • votes: 0
  • watchers: 6
  • imported: 2025-12-02

Raw content of original issue

In a pipeline job from a git repository where the "Branch Specifier" is given as a parameter, I started getting the following failure after updating the git plugin.



hudson.plugins.git.GitException: Command "git fetch --tags --progress origin +refs/heads/$\{GITREF}:refs/remotes/origin/$\{GITREF} --prune" returned status code 128:

stdout:
stderr: fatal: Couldn't find remote ref refs/heads/$\{GITREF}

        at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1799)
        at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1525)
        at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:65)
        at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:316)
        at jenkins.plugins.git.GitSCMFileSystem$BuilderImpl.build(GitSCMFileSystem.java:304)
        at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:196)
        at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:172)
        at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:99)
        at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:59)
        at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:232)
        at hudson.model.ResourceController.execute(ResourceController.java:98)
        at hudson.model.Executor.run(Executor.java:404)
Finished: FAILURE



I have tested all released version of the git plugin from 3.0.1 to 3.2.0 and the failure seems to have appeared in 3.0.2.

I don't know if it is relevant but with the Git plugin version 3.0.1, I see this at the beginning of the log:
Lightweight checkout support not available, falling back to full checkout.
 

environment

```
Jenkins ver. 2.19.3

Git Plugin 3.0.2 to 3.2.0
```

2 attachments

- [Selection_001.png](https://issues.jenkins.io/secure/attachment/37901/Selection_001.png)
> ![Selection_001.png](https://issues.jenkins.io/secure/attachment/37901/Selection_001.png)
- [lightweight-checkout-doco.png](https://issues.jenkins.io/secure/attachment/37913/lightweight-checkout-doco.png)
> ![lightweight-checkout-doco.png](https://issues.jenkins.io/secure/attachment/37913/lightweight-checkout-doco.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.