Closed khanhldt closed 2 years ago
I got a problem using this plugin with refspec not escaping the dollar sign (dollar sign is a valid character for naming git branch). See log below
refspec
09:49:28 hudson.plugins.git.GitException: Command "git fetch --no-tags --force --progress --depth=1 -- git@github.com:lyft/LYFT-REPO.git +refs/heads/use-install-go-from-$PATH:refs/remotes/origin/use-install-go-from-$PATH" returned status code 128: 09:49:28 stdout: 09:49:28 stderr: fatal: invalid refspec '+refs/heads/use-install-go-from-/usr/local/openjdk-11/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:refs/remotes/origin/use-install-go-from-/usr/local/openjdk-11/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
The command I ran is something along the lines of
checkout scm: [ $class: 'GitSCM', branches: branches, extensions: [ [$class: 'GitLFSPull'], clone_option, [$class: 'RelativeTargetDirectory', relativeTargetDir: 'target'] ], userRemoteConfigs: [[ credentialsId: 'ssh-key', url: "git@${github_url}:${repo_full_name}.git", refspec: "${refspec}" ]]
I tried to escape the value before passing into the call (e.g. refspec.replace('$', '\$')), but that didn't help regardless of how many backslashes I used.
refspec.replace('$', '\$')
Well, I realized that I should have filed this with Jenkins instead. Closing for now.
Description
I got a problem using this plugin with
refspec
not escaping the dollar sign (dollar sign is a valid character for naming git branch). See log belowThe command I ran is something along the lines of
What did I try
I tried to escape the value before passing into the call (e.g.
refspec.replace('$', '\$')
), but that didn't help regardless of how many backslashes I used.