jenkinsci / jenkinsci/git-plugin

[JENKINS-23556] Git fetch fails when Repository URL is a Parameter with trailing whitespace

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

Description

We have a job which passes the GIT_URL as a string parameter, supplied by the user. When the user does a Copy + Paste into the value field, sometimes a trailing whitespace is included. This appears to mess the plugin up somehow.

We are also using multiSCM, but I doubt it's related to the underlying issue.

If the Git URL is configured in the job config, the trailing whitespace is automatically trimmed when the job configuration is saved into config.xml. So this is only an issue if the GIT_URL is provided as a parameter to the job.

When the Git URL is a parameter, the whitespace is not trimmed, and the job fails during git fetch with the following log output:

Cloning repository git://my/git/URL.git

Fetching upstream changes from git://my/git/URL.git

FATAL: Failed to fetch from git://my/git/URL.git

hudson.plugins.git.GitException: Failed to fetch from git://my/git/URL.git

at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java.623)

at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java.855)

at hudson.plugins.git.GitSCM.checkout(GitSCM.java:880)

at org.jenkinsci.plugins.multiplescms.MultiSCM.checkout(MultiSCM.java:118)

at ...

Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress git://my/git/URL.git +refs/heads/:refs/remotes/origin/" returned status code 128:

stdout:

stderr: fatal: The remote end hung up unexpectedly

at org.jenkinssci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1276)

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1146)

at ...

Not a big deal, as long as we know to trim the whitespace manually.

---
Originally reported by jthornsen, imported from: Git fetch fails when Repository URL is a Parameter with trailing whitespace


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

Raw content of original issue

We have a job which passes the GIT_URL as a string parameter, supplied by the user. When the user does a Copy + Paste into the value field, sometimes a trailing whitespace is included. This appears to mess the plugin up somehow.

We are also using multiSCM, but I doubt it's related to the underlying issue.

If the Git URL is configured in the job config, the trailing whitespace is automatically trimmed when the job configuration is saved into config.xml. So this is only an issue if the GIT_URL is provided as a parameter to the job.

When the Git URL is a parameter, the whitespace is not trimmed, and the job fails during git fetch with the following log output:

Cloning repository git://my/git/URL.git
Fetching upstream changes from git://my/git/URL.git
FATAL: Failed to fetch from git://my/git/URL.git
hudson.plugins.git.GitException: Failed to fetch from git://my/git/URL.git
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java.623)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java.855)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:880)
at org.jenkinsci.plugins.multiplescms.MultiSCM.checkout(MultiSCM.java:118)
at ...
Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress git://my/git/URL.git +refs/heads/:refs/remotes/origin/" returned status code 128:
stdout:
stderr: fatal: The remote end hung up unexpectedly

at org.jenkinssci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1276)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1146)
at ...

Not a big deal, as long as we know to trim the whitespace manually.

environment

```
Jenkins 1.559

git plugin 2.2.1

git-client plugin 1.8.0

multiple-scms plugin 0.3

RHEL6 master with RHEL5 slave
```

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.