hudson.plugins.git.GitException: Command "git push git-company@server.company.com:/srv/company.git build-121 " returned status code 128: stdout: stderr: fatal: remote part of refspec is not a valid name in build-121

Jenkins JIRA | Willem Stuursma | 5 years ago
  1. 0

    Using git plugin 1.1.17. If you accidentally leave in whitespace in the "Tag to push" field, git will create a tag with the whitespace replaced by an "_". E.g. if you configure a tag like "build-${BUILD_NUMBER} " (note the whitespace at the end of the field), the created tag will then be "build-121_" or the like. The tag will be created locally but pushing the tag will fail because it will try to push the tag without the "_", and this tag will not exist. {code} Pushing tag build-121 to repo origin ERROR: Failed to push tag build-121 to origin hudson.plugins.git.GitException: Command "git push git-company@server.company.com:/srv/company.git build-121 " returned status code 128: stdout: stderr: fatal: remote part of refspec is not a valid name in build-121 at hudson.plugins.git.GitAPI.launchCommandIn(GitAPI.java:779) at hudson.plugins.git.GitAPI.launchCommand(GitAPI.java:741) at hudson.plugins.git.GitAPI.push(GitAPI.java:797) at hudson.plugins.git.GitPublisher$3.invoke(GitPublisher.java:277) at hudson.plugins.git.GitPublisher$3.invoke(GitPublisher.java:247) at hudson.FilePath.act(FilePath.java:832) at hudson.FilePath.act(FilePath.java:814) at hudson.plugins.git.GitPublisher.perform(GitPublisher.java:247) at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36) at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:705) at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:680) at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:658) at hudson.model.Build$RunnerImpl.post2(Build.java:162) at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:627) at hudson.model.Run.run(Run.java:1446) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:238) Build step 'Git Publisher' changed build result to FAILURE {code} This error kind of pointed me in the wrong direction and it took some time to figure this out, it would be really great if the field could be trimmed, hopefully it will save some people some time if they have this same problem. Alternatively, you could give an error when leaving whitespace in the "Tag to push" field.

    Jenkins JIRA | 5 years ago | Willem Stuursma
    hudson.plugins.git.GitException: Command "git push git-company@server.company.com:/srv/company.git build-121 " returned status code 128: stdout: stderr: fatal: remote part of refspec is not a valid name in build-121
  2. 0

    Using git plugin 1.1.17. If you accidentally leave in whitespace in the "Tag to push" field, git will create a tag with the whitespace replaced by an "_". E.g. if you configure a tag like "build-${BUILD_NUMBER} " (note the whitespace at the end of the field), the created tag will then be "build-121_" or the like. The tag will be created locally but pushing the tag will fail because it will try to push the tag without the "_", and this tag will not exist. {code} Pushing tag build-121 to repo origin ERROR: Failed to push tag build-121 to origin hudson.plugins.git.GitException: Command "git push git-company@server.company.com:/srv/company.git build-121 " returned status code 128: stdout: stderr: fatal: remote part of refspec is not a valid name in build-121 at hudson.plugins.git.GitAPI.launchCommandIn(GitAPI.java:779) at hudson.plugins.git.GitAPI.launchCommand(GitAPI.java:741) at hudson.plugins.git.GitAPI.push(GitAPI.java:797) at hudson.plugins.git.GitPublisher$3.invoke(GitPublisher.java:277) at hudson.plugins.git.GitPublisher$3.invoke(GitPublisher.java:247) at hudson.FilePath.act(FilePath.java:832) at hudson.FilePath.act(FilePath.java:814) at hudson.plugins.git.GitPublisher.perform(GitPublisher.java:247) at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36) at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:705) at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:680) at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:658) at hudson.model.Build$RunnerImpl.post2(Build.java:162) at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:627) at hudson.model.Run.run(Run.java:1446) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:238) Build step 'Git Publisher' changed build result to FAILURE {code} This error kind of pointed me in the wrong direction and it took some time to figure this out, it would be really great if the field could be trimmed, hopefully it will save some people some time if they have this same problem. Alternatively, you could give an error when leaving whitespace in the "Tag to push" field.

    Jenkins JIRA | 5 years ago | Willem Stuursma
    hudson.plugins.git.GitException: Command "git push git-company@server.company.com:/srv/company.git build-121 " returned status code 128: stdout: stderr: fatal: remote part of refspec is not a valid name in build-121
  3. 0

    Jenkins - Can't push tag to remote repository

    Stack Overflow | 3 years ago | Atul
    hudson.plugins.git.GitException: Error performing command: /usr/bin/git push > git@github.paypal.com:atagrawal/maven-test-3.git tag02 Command "/usr/bin/git push git@github.paypal.com:atagrawal/maven-test-3.git tag02" returned > status code 128: ERROR: Permission to atagrawal/maven-test-3.git > denied to gitadmin. fatal: The remote end hung up unexpectedly
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    It seems that the GIT-Publisher does not use those credentials that are set for the repo. Checkout/Clone at the beginning of a job works fine and uses the set credentials. {code} Fetching changes from the remote Git repository Fetching upstream changes from git@gi-server.tld/project.git using GIT_SSH to set credentials WRITE permissions for gitlab Checking out Revision XXXX (origin/SOME_BRANCH) {code} As soon as I want the job to push a tag with GIT-Publisher, it fails since it does not use those credentials. {code} [Boolean condition] checking [true] against [^(1|y|yes|t|true|on|run)$] (origin token: true) Run condition [Boolean condition] enabling perform for step [Git Publisher] Pushing tag job-name-release-296 to repo origin ERROR: Failed to push tag job-name-release-296 to origin hudson.plugins.git.GitException: Command "git push git@git-server.tld/project.git job-name-release-296" returned status code 128: stdout: stderr: Access denied. fatal: The remote end hung up unexpectedly at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1099) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:985) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.push(CliGitAPIImpl.java:1123) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.push(CliGitAPIImpl.java:1135) at hudson.plugins.git.GitAPI.push(GitAPI.java:65) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:274) at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:255) at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:215) at hudson.remoting.UserRequest.perform(UserRequest.java:118) at hudson.remoting.UserRequest.perform(UserRequest.java:48) at hudson.remoting.Request$2.run(Request.java:287) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at hudson.remoting.Engine$1$1.run(Engine.java:60) at java.lang.Thread.run(Thread.java:679) Build step 'Flexible publish' changed build result to FAILURE {code} This issue, together with JENKINS-21110 renders the GIT-Publisher rather unusable.

    Jenkins JIRA | 3 years ago | Udo Waechter
    hudson.plugins.git.GitException: Command "git push git@git-server.tld/project.git job-name-release-296" returned status code 128: stdout: stderr: Access denied. fatal: The remote end hung up unexpectedly
  6. 0

    It seems that the GIT-Publisher does not use those credentials that are set for the repo. Checkout/Clone at the beginning of a job works fine and uses the set credentials. {code} Fetching changes from the remote Git repository Fetching upstream changes from git@gi-server.tld/project.git using GIT_SSH to set credentials WRITE permissions for gitlab Checking out Revision XXXX (origin/SOME_BRANCH) {code} As soon as I want the job to push a tag with GIT-Publisher, it fails since it does not use those credentials. {code} [Boolean condition] checking [true] against [^(1|y|yes|t|true|on|run)$] (origin token: true) Run condition [Boolean condition] enabling perform for step [Git Publisher] Pushing tag job-name-release-296 to repo origin ERROR: Failed to push tag job-name-release-296 to origin hudson.plugins.git.GitException: Command "git push git@git-server.tld/project.git job-name-release-296" returned status code 128: stdout: stderr: Access denied. fatal: The remote end hung up unexpectedly at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1099) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:985) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.push(CliGitAPIImpl.java:1123) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.push(CliGitAPIImpl.java:1135) at hudson.plugins.git.GitAPI.push(GitAPI.java:65) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:274) at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:255) at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:215) at hudson.remoting.UserRequest.perform(UserRequest.java:118) at hudson.remoting.UserRequest.perform(UserRequest.java:48) at hudson.remoting.Request$2.run(Request.java:287) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at hudson.remoting.Engine$1$1.run(Engine.java:60) at java.lang.Thread.run(Thread.java:679) Build step 'Flexible publish' changed build result to FAILURE {code} This issue, together with JENKINS-21110 renders the GIT-Publisher rather unusable.

    Jenkins JIRA | 3 years ago | Udo Waechter
    hudson.plugins.git.GitException: Command "git push git@git-server.tld/project.git job-name-release-296" returned status code 128: stdout: stderr: Access denied. fatal: The remote end hung up unexpectedly

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. hudson.plugins.git.GitException

      Command "git push git-company@server.company.com:/srv/company.git build-121 " returned status code 128: stdout: stderr: fatal: remote part of refspec is not a valid name in build-121

      at hudson.plugins.git.GitAPI.launchCommandIn()
    2. Hudson GIT plugin
      GitPublisher$3.invoke
      1. hudson.plugins.git.GitAPI.launchCommandIn(GitAPI.java:779)
      2. hudson.plugins.git.GitAPI.launchCommand(GitAPI.java:741)
      3. hudson.plugins.git.GitAPI.push(GitAPI.java:797)
      4. hudson.plugins.git.GitPublisher$3.invoke(GitPublisher.java:277)
      5. hudson.plugins.git.GitPublisher$3.invoke(GitPublisher.java:247)
      5 frames
    3. Hudson
      FilePath.act
      1. hudson.FilePath.act(FilePath.java:832)
      2. hudson.FilePath.act(FilePath.java:814)
      2 frames
    4. Hudson GIT plugin
      GitPublisher.perform
      1. hudson.plugins.git.GitPublisher.perform(GitPublisher.java:247)
      1 frame
    5. Hudson
      Executor.run
      1. hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
      2. hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:705)
      3. hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:680)
      4. hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:658)
      5. hudson.model.Build$RunnerImpl.post2(Build.java:162)
      6. hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:627)
      7. hudson.model.Run.run(Run.java:1446)
      8. hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      9. hudson.model.ResourceController.execute(ResourceController.java:88)
      10. hudson.model.Executor.run(Executor.java:238)
      10 frames