Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-45212

Using git-cmd instead of git on Windows reports Invalid ID USERNAME

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Blocker Blocker
    • git-plugin
    • None
    • System: Windows 8.1
      Jenkins: last version
      Git-plugin: last version
      Git: last version

      There is an issue:

      org.eclipse.jgit.errors.InvalidObjectIdException: Invalid id: ]9;8;"USERNAME"\@]9;8;"COMP at org.eclipse.jgit.lib.ObjectId.fromHexString(ObjectId.java:246) at org.eclipse.jgit.lib.ObjectId.fromString(ObjectId.java:234) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.getHeadRev(CliGitAPIImpl.java:2675) at hudson.plugins.git.UserRemoteConfig$DescriptorImpl.doCheckUrl(UserRemoteConfig.java:198) at java.lang.invoke.MethodHandle.invokeWithArguments(Unknown Source) at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:343) at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:184) at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:117) at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:129) at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715) Caused: javax.servlet.ServletException at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:765) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845) at org.kohsuke.stapler.MetaClass$5.doDispatch(MetaClass.java:248) at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845) at org.kohsuke.stapler.MetaClass$5.doDispatch(MetaClass.java:248) at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649) at org.kohsuke.stapler.Stapler.service(Stapler.java:238) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:135) at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:138) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:86) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84) at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) at jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:117) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:92) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249) at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:90) at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:553) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) at org.eclipse.jetty.server.Server.handle(Server.java:499) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257) at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544) at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)
      

          [JENKINS-45212] Using git-cmd instead of git on Windows reports Invalid ID USERNAME

          Mark Waite added a comment -

          Please provide sufficient steps so that others can duplicate the problem you're reporting.

          Based on the stack trace, I'd guess that you inserted USERNAME into one of the fields in the configuration web page.

          Mark Waite added a comment - Please provide sufficient steps so that others can duplicate the problem you're reporting. Based on the stack trace, I'd guess that you inserted USERNAME into one of the fields in the configuration web page.

          Nikita Gerasimenko added a comment - - edited

          Screenshots

            

          Steps to reproduce:

          1. Setup Global Configuration for git-plugin (Path: C:********\git-cmd.exe
          2. For github generated and installed ssh key
          3. Allure-report plugin installed as well
          4. NodeJS both version 6.9.4 and latest 
          5. Jenkins run on localhost
          6. URL to remote repository was used in both formats - git@github.com:Username/repo.git and https://github.com/username/repo

           

          Nikita Gerasimenko added a comment - - edited Screenshots    Steps to reproduce: Setup Global Configuration for git-plugin (Path: C:********\git-cmd.exe For github generated and installed ssh key Allure-report plugin installed as well NodeJS both version 6.9.4 and latest  Jenkins run on localhost URL to remote repository was used in both formats - git@github.com:Username/repo.git and https://githu b.com/username/repo  

          The username and useremail parametrs has been added in addition but anyway the same issue still exist.

          Building in workspace D:\Jenkins\workspace\example
          Cloning the remote Git repository
          Cloning repository
          > C:\Program Files\Git\git-cmd.exe init D:\Jenkins\workspace-example # timeout=10
          Fetching upstream changes from
          > C:\Program Files\Git\git-cmd.exe --version # timeout=10
          > C:\Program Files\Git\git-cmd.exe fetch --tags
          +refs/heads/:refs/remotes/origin/
          > C:\Program Files\Git\git-cmd.exe config remote.origin.url

          1. timeout=10
            > C:\Program Files\Git\git-cmd.exe config --add remote.origin.fetch +refs/heads/:refs/remotes/origin/ # timeout=10
            > C:\Program Files\Git\git-cmd.exe config remote.origin.url
          2. timeout=10
            Fetching upstream changes from
            > C:\Program Files\Git\git-cmd.exe --version # timeout=10
            > C:\Program Files\Git\git-cmd.exe fetch --tags
            +refs/heads/:refs/remotes/origin/
            > C:\Program Files\Git\git-cmd.exe rev-parse "refs/remotes/origin/master^{commit}" # timeout=10
            FATAL: Invalid id: [m]9;8;"USERNAME"@]9;8;"COMPUTERNAME"\ D:\Jenkins\workspace\protractor-allure-reporting-example
            > ]9;12\
            org.eclipse.jgit.errors.InvalidObjectIdException: Invalid id: [m]9;8;"USERNAME"@]9;8;"COMPUTERNAME"\ D:\Jenkins\workspace\protractor-allure-reporting-example
            > ]9;12\
            at org.eclipse.jgit.lib.ObjectId.fromString(ObjectId.java:232)
            at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.revParse(CliGitAPIImpl.java:722)
            at hudson.plugins.git.GitAPI.revParse(GitAPI.java:316)
            at hudson.plugins.git.util.DefaultBuildChooser.getHeadRevision(DefaultBuildChooser.java:130)
            at hudson.plugins.git.util.DefaultBuildChooser.getCandidateRevisions(DefaultBuildChooser.java:112)
            at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:1004)
            at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1111)
            at hudson.scm.SCM.checkout(SCM.java:495)
            at hudson.model.AbstractProject.checkout(AbstractProject.java:1276)
            at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:560)
            at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
            at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:485)
            at hudson.model.Run.execute(Run.java:1735)
            at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
            at hudson.model.ResourceController.execute(ResourceController.java:97)
            at hudson.model.Executor.run(Executor.java:405)
            ERROR: Step ‘Allure Report’ aborted due to exception:
            java.nio.file.NoSuchFileException: D:\Jenkins\workspace\protractor-allure-reporting-example\target\allure-results
            at sun.nio.fs.WindowsException.translateToIOException(Unknown Source)
            at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
            at sun.nio.fs.WindowsLinkSupport.getRealPath(Unknown Source)
            at sun.nio.fs.WindowsPath.toRealPath(Unknown Source)
            at sun.nio.fs.WindowsPath.toRealPath(Unknown Source)
            at ru.yandex.qatools.allure.jenkins.callables.AbstractAddInfo.invoke(AbstractAddInfo.java:23)
            at ru.yandex.qatools.allure.jenkins.callables.AbstractAddInfo.invoke(AbstractAddInfo.java:19)
            at hudson.FilePath.act(FilePath.java:997)
            at hudson.FilePath.act(FilePath.java:975)
            at ru.yandex.qatools.allure.jenkins.AllureReportPublisher.addTestRunInfo(AllureReportPublisher.java:239)
            at ru.yandex.qatools.allure.jenkins.AllureReportPublisher.prepareResults(AllureReportPublisher.java:230)
            at ru.yandex.qatools.allure.jenkins.AllureReportPublisher.perform(AllureReportPublisher.java:93)
            at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:81)
            at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
            at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:735)
            at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:676)
            at hudson.model.Build$BuildExecution.post2(Build.java:186)
            at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:621)
            at hudson.model.Run.execute(Run.java:1760)
            at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
            at hudson.model.ResourceController.execute(ResourceController.java:97)
            at hudson.model.Executor.run(Executor.java:405)
            Finished: FAILURE

          Nikita Gerasimenko added a comment - The username and useremail parametrs has been added in addition but anyway the same issue still exist. Building in workspace D:\Jenkins\workspace\example Cloning the remote Git repository Cloning repository > C:\Program Files\Git\git-cmd.exe init D:\Jenkins\workspace-example # timeout=10 Fetching upstream changes from > C:\Program Files\Git\git-cmd.exe --version # timeout=10 > C:\Program Files\Git\git-cmd.exe fetch --tags +refs/heads/ :refs/remotes/origin/ > C:\Program Files\Git\git-cmd.exe config remote.origin.url timeout=10 > C:\Program Files\Git\git-cmd.exe config --add remote.origin.fetch +refs/heads/ :refs/remotes/origin/ # timeout=10 > C:\Program Files\Git\git-cmd.exe config remote.origin.url timeout=10 Fetching upstream changes from > C:\Program Files\Git\git-cmd.exe --version # timeout=10 > C:\Program Files\Git\git-cmd.exe fetch --tags +refs/heads/ :refs/remotes/origin/ > C:\Program Files\Git\git-cmd.exe rev-parse "refs/remotes/origin/master^{commit}" # timeout=10 FATAL: Invalid id: [m [32m] 9;8;"USERNAME"@]9;8;"COMPUTERNAME"\ D:\Jenkins\workspace\protractor-allure-reporting-example > [m ] 9;12\ org.eclipse.jgit.errors.InvalidObjectIdException: Invalid id: [m [32m] 9;8;"USERNAME"@]9;8;"COMPUTERNAME"\ D:\Jenkins\workspace\protractor-allure-reporting-example > [m ] 9;12\ at org.eclipse.jgit.lib.ObjectId.fromString(ObjectId.java:232) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.revParse(CliGitAPIImpl.java:722) at hudson.plugins.git.GitAPI.revParse(GitAPI.java:316) at hudson.plugins.git.util.DefaultBuildChooser.getHeadRevision(DefaultBuildChooser.java:130) at hudson.plugins.git.util.DefaultBuildChooser.getCandidateRevisions(DefaultBuildChooser.java:112) at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:1004) at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1111) at hudson.scm.SCM.checkout(SCM.java:495) at hudson.model.AbstractProject.checkout(AbstractProject.java:1276) at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:560) at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:485) at hudson.model.Run.execute(Run.java:1735) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:405) ERROR: Step ‘Allure Report’ aborted due to exception: java.nio.file.NoSuchFileException: D:\Jenkins\workspace\protractor-allure-reporting-example\target\allure-results at sun.nio.fs.WindowsException.translateToIOException(Unknown Source) at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source) at sun.nio.fs.WindowsLinkSupport.getRealPath(Unknown Source) at sun.nio.fs.WindowsPath.toRealPath(Unknown Source) at sun.nio.fs.WindowsPath.toRealPath(Unknown Source) at ru.yandex.qatools.allure.jenkins.callables.AbstractAddInfo.invoke(AbstractAddInfo.java:23) at ru.yandex.qatools.allure.jenkins.callables.AbstractAddInfo.invoke(AbstractAddInfo.java:19) at hudson.FilePath.act(FilePath.java:997) at hudson.FilePath.act(FilePath.java:975) at ru.yandex.qatools.allure.jenkins.AllureReportPublisher.addTestRunInfo(AllureReportPublisher.java:239) at ru.yandex.qatools.allure.jenkins.AllureReportPublisher.prepareResults(AllureReportPublisher.java:230) at ru.yandex.qatools.allure.jenkins.AllureReportPublisher.perform(AllureReportPublisher.java:93) at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:81) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:735) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:676) at hudson.model.Build$BuildExecution.post2(Build.java:186) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:621) at hudson.model.Run.execute(Run.java:1760) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:405) Finished: FAILURE

          Mark Waite added a comment - - edited

          I can't duplicate your problem, even with that information.

          Some things you might attempt:

          1. Describe how you installed command line git. I've never seen a command line git program named "git-cmd.exe". I see one on my computer in the C:\Program Files\Git\git-cmd.exe file, but when I run that program, it does not perform git operations. I believe that program is used to start a command prompt window which includes the git program in its path. If that is your configuration, then I assume you have never successfully cloned anything with git on this Jenkins installation. Change your configuration to either make the git program git, or make it C:\Program Files\Git\cmd\git.exe or make it C:\Program Files\Git\bin\git.exe and see if that helps. If that helps, please describe where you found the recommendation to configure git-cmd.exe as the git program. We need to fix that location
          2. Create a new job which is a copy of the problem job. Run it, see if it still fails. If it fails, then the crucial difference between your case and mine is likely in the environment where you're running Jenkins. Explore that environment further, especially around USERNAME and COMPUTERNAME environment variables
          3. Wipe the workspace of the problem job. Run it again, see if it still fails. If it does not fail, then the crucial difference between your case and mine is likely in the initial definition of that job. If that is the case, look further at your initial use of parameters to the job
          4. Describe the precise versions of the plugins you're using, rather than "latest". The latest version today may not be the latest version next week

          Mark Waite added a comment - - edited I can't duplicate your problem, even with that information. Some things you might attempt: Describe how you installed command line git. I've never seen a command line git program named "git-cmd.exe". I see one on my computer in the C:\Program Files\Git\git-cmd.exe file, but when I run that program, it does not perform git operations. I believe that program is used to start a command prompt window which includes the git program in its path. If that is your configuration, then I assume you have never successfully cloned anything with git on this Jenkins installation. Change your configuration to either make the git program git , or make it C:\Program Files\Git\cmd\git.exe or make it C:\Program Files\Git\bin\git.exe and see if that helps. If that helps, please describe where you found the recommendation to configure git-cmd.exe as the git program. We need to fix that location Create a new job which is a copy of the problem job. Run it, see if it still fails. If it fails, then the crucial difference between your case and mine is likely in the environment where you're running Jenkins. Explore that environment further, especially around USERNAME and COMPUTERNAME environment variables Wipe the workspace of the problem job. Run it again, see if it still fails. If it does not fail, then the crucial difference between your case and mine is likely in the initial definition of that job. If that is the case, look further at your initial use of parameters to the job Describe the precise versions of the plugins you're using, rather than "latest". The latest version today may not be the latest version next week

          Yes, it seems you are right. The issue was in path to git. The correct way is  C:\Program Files\Git\bin\git.exe and only git.exe should be in the path.

          Nikita Gerasimenko added a comment - Yes, it seems you are right. The issue was in path to git. The correct way is  C:\Program Files\Git\bin\git.exe  and only git.exe should be in the path.

          Mark Waite added a comment -

          gnikita9 that is great news. Was there a location where you found the instructions to use git-cmd.exe (so that we can correct it)?

          I think I may want to insert a "safety check" into the git client plugin to give a better warning in case of that mistake. It is already more difficult than I want to make authenticated git repositories work well. I'd love to have one case where an incorrect configuration generates a clear message, instead of a stack trace.

          Mark Waite added a comment - gnikita9 that is great news. Was there a location where you found the instructions to use git-cmd.exe (so that we can correct it)? I think I may want to insert a "safety check" into the git client plugin to give a better warning in case of that mistake. It is already more difficult than I want to make authenticated git repositories work well. I'd love to have one case where an incorrect configuration generates a clear message, instead of a stack trace.

          Unfortunately I can't provide the exact place where it was found because there was one of the tickets on stackoverflow if I'm not mistaken

          Nikita Gerasimenko added a comment - Unfortunately I can't provide the exact place where it was found because there was one of the tickets on stackoverflow if I'm not mistaken

          Mark Waite added a comment -

          Thanks. I found two stackoverflow articles (here and here) which included the same mistake. Both were describing problems, and neither had a viable answer as far as I could tell.

          I've attempted to post a correction, in hopes we'll avoid other users encountering the same problem. We'll see if my limited stackoverflow skills are enough to prevent their moderators from rejecting my answers for failure to follow policy.

          Mark Waite added a comment - Thanks. I found two stackoverflow articles ( here and here ) which included the same mistake. Both were describing problems, and neither had a viable answer as far as I could tell. I've attempted to post a correction, in hopes we'll avoid other users encountering the same problem. We'll see if my limited stackoverflow skills are enough to prevent their moderators from rejecting my answers for failure to follow policy.

          Nikita Gerasimenko added a comment - - edited

          Thank you. I'll add a comment with refer link to this post and other posts with similar issue as well. Hope it'll help to avoid this problem.

          Nikita Gerasimenko added a comment - - edited Thank you. I'll add a comment with refer link to this post and other posts with similar issue as well. Hope it'll help to avoid this problem.

          Mark Waite added a comment -

          Configuration error by the user, not ready to support the differences between the supported git commands (git.exe and git.cmd) and the git commands which the plugin does not support (git-cmd.exe and git-bash.exe)

          Mark Waite added a comment - Configuration error by the user, not ready to support the differences between the supported git commands (git.exe and git.cmd) and the git commands which the plugin does not support (git-cmd.exe and git-bash.exe)

            Unassigned Unassigned
            gnikita9 Nikita Gerasimenko
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: