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

Credentialed git init fails with "file exists" - reuses same tmp dir for all credentials

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: git-client-plugin
    • Labels:
      None
    • Environment:
      Windows Server 2003 SP2, Jenkins 1.551, Git Plugin 2.0.1
    • Similar Issues:

      Description

      After a remote trigger the git init command failed with the following exception:

      Started on 5/03/2014 1:42:45 PM
      Using strategy: Default
      [poll] Last Built Revision: Revision 6c615c2d4570d1aa9288afd73588a7328073e832 (origin/master)
      using .gitcredentials to set credentials
      Could not remove the credential section from the git configuration
      FATAL: hudson.plugins.git.GitException: Command "git init" returned status code 128:
      stdout:
      stderr: fatal: cannot copy 'C:\Program Files\Git/share/git-core/templates/description' to 'C:/DOCUME~1/!SYSCA~1/LOCALS~1/Temp/.git/description': File exists

      ha:AAAAWB+LCAAAAAAAAP9b85aBtbiIQSmjNKU4P08vOT+vOD8nVc8DzHWtSE4tKMnMz/PLL0ldFVf2c+b/lb5MDAwVRQxSaBqcITRIIQMEMIIUFgAAckCEiWAAAAA=hudson.util.IOException2: hudson.plugins.git.GitException: Command "git init" returned status code 128:
      stdout:
      stderr: fatal: cannot copy 'C:\Program Files\Git/share/git-core/templates/description' to 'C:/DOCUME~1/!SYSCA~1/LOCALS~1/Temp/.git/description': File exists

      at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:459)
      at hudson.scm.SCM._compareRemoteRevisionWith(SCM.java:356)
      at hudson.scm.SCM.poll(SCM.java:373)
      at hudson.model.AbstractProject._poll(AbstractProject.java:1581)
      at hudson.model.AbstractProject.poll(AbstractProject.java:1490)
      at hudson.triggers.SCMTrigger$Runner.runPolling(SCMTrigger.java:462)
      at hudson.triggers.SCMTrigger$Runner.run(SCMTrigger.java:491)
      at hudson.util.SequentialExecutionQueue$QueueEntry.run(SequentialExecutionQueue.java:118)
      at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
      at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      at java.util.concurrent.FutureTask.run(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
      Caused by: hudson.plugins.git.GitException: Command "git init" returned status code 128:
      stdout:
      stderr: fatal: cannot copy 'C:\Program Files\Git/share/git-core/templates/description' to 'C:/DOCUME~1/!SYSCA~1/LOCALS~1/Temp/.git/description': File exists

      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1173)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1150)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1146)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1142)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1035)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:988)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:979)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.getHeadRev(CliGitAPIImpl.java:1526)
      at hudson.plugins.git.GitSCM.compareRemoteRevisionWithImpl(GitSCM.java:489)
      at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:457)
      ... 13 more
      Done. Took 0.5 sec
      No changes

      The second time it failed with a similar exception:

      Started on 5/03/2014 1:46:38 PM
      Using strategy: Default
      [poll] Last Built Revision: Revision 6c615c2d4570d1aa9288afd73588a7328073e832 (origin/master)
      using .gitcredentials to set credentials
      Could not remove the credential section from the git configuration
      FATAL: hudson.plugins.git.GitException: Command "git init" returned status code 128:
      stdout:
      stderr: fatal: cannot copy 'C:\Program Files\Git/share/git-core/templates/hooks/post-update.sample' to 'C:/DOCUME~1/!SYSCA~1/LOCALS~1/Temp/.git/hooks/post-update.sample': File exists

      ha:AAAAWB+LCAAAAAAAAP9b85aBtbiIQSmjNKU4P08vOT+vOD8nVc8DzHWtSE4tKMnMz/PLL0ldFVf2c+b/lb5MDAwVRQxSaBqcITRIIQMEMIIUFgAAckCEiWAAAAA=hudson.util.IOException2: hudson.plugins.git.GitException: Command "git init" returned status code 128:
      stdout:
      stderr: fatal: cannot copy 'C:\Program Files\Git/share/git-core/templates/hooks/post-update.sample' to 'C:/DOCUME~1/!SYSCA~1/LOCALS~1/Temp/.git/hooks/post-update.sample': File exists

      at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:459)
      at hudson.scm.SCM._compareRemoteRevisionWith(SCM.java:356)
      at hudson.scm.SCM.poll(SCM.java:373)
      at hudson.model.AbstractProject._poll(AbstractProject.java:1581)
      at hudson.model.AbstractProject.poll(AbstractProject.java:1490)
      at hudson.triggers.SCMTrigger$Runner.runPolling(SCMTrigger.java:462)
      at hudson.triggers.SCMTrigger$Runner.run(SCMTrigger.java:491)
      at hudson.util.SequentialExecutionQueue$QueueEntry.run(SequentialExecutionQueue.java:118)
      at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
      at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      at java.util.concurrent.FutureTask.run(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
      Caused by: hudson.plugins.git.GitException: Command "git init" returned status code 128:
      stdout:
      stderr: fatal: cannot copy 'C:\Program Files\Git/share/git-core/templates/hooks/post-update.sample' to 'C:/DOCUME~1/!SYSCA~1/LOCALS~1/Temp/.git/hooks/post-update.sample': File exists

      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1173)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1150)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1146)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1142)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1035)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:988)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:979)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.getHeadRev(CliGitAPIImpl.java:1526)
      at hudson.plugins.git.GitSCM.compareRemoteRevisionWithImpl(GitSCM.java:489)
      at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:457)
      ... 13 more
      Done. Took 0.31 sec
      No changes

      Both times the .git folder had been deleted before triggering.

        Attachments

          Activity

          Hide
          mightymuke Marcus Bristol added a comment - - edited

          There was an existing empty git repo in the temp folder. I removed it and created a .git file as suggested, manually kicked off the build, and it all worked fine.

          However, when initiating a build via remote polling I get this:

          Started on 20/03/2014 3:59:54 PM
          Using strategy: Default
          [poll] Last Built Revision: Revision be2c3d7df7fa6eb0de12b3b7b50c1180ad63cb2f (origin/master)
          using .gitcredentials to set credentials
          Could not remove the credential section from the git configuration
          FATAL: hudson.plugins.git.GitException: Command "git init" returned status code 128:
          stdout: 
          stderr: fatal: Invalid gitfile format: C:/DOCUME~1/!SYSCA~1/LOCALS~1/Temp/.git
          
          hudson.util.IOException2: hudson.plugins.git.GitException: Command "git init" returned status code 128:
          stdout: 
          stderr: fatal: Invalid gitfile format: C:/DOCUME~1/!SYSCA~1/LOCALS~1/Temp/.git
          
          	at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:458)
          	at hudson.scm.SCM._compareRemoteRevisionWith(SCM.java:356)
          	at hudson.scm.SCM.poll(SCM.java:373)
          	at hudson.model.AbstractProject._poll(AbstractProject.java:1584)
          	at hudson.model.AbstractProject.poll(AbstractProject.java:1493)
          	at hudson.triggers.SCMTrigger$Runner.runPolling(SCMTrigger.java:462)
          	at hudson.triggers.SCMTrigger$Runner.run(SCMTrigger.java:491)
          	at hudson.util.SequentialExecutionQueue$QueueEntry.run(SequentialExecutionQueue.java:118)
          	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
          	at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
          	at java.util.concurrent.FutureTask.run(Unknown Source)
          	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
          	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
          	at java.lang.Thread.run(Unknown Source)
          Caused by: hudson.plugins.git.GitException: Command "git init" returned status code 128:
          stdout: 
          stderr: fatal: Invalid gitfile format: C:/DOCUME~1/!SYSCA~1/LOCALS~1/Temp/.git
          
          	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1183)
          	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1160)
          	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1156)
          	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1152)
          	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1045)
          	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:998)
          	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:989)
          	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.getHeadRev(CliGitAPIImpl.java:1535)
          	at hudson.plugins.git.GitSCM.compareRemoteRevisionWithImpl(GitSCM.java:491)
          	at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:456)
          	... 13 more
          Done. Took 2.6 sec
          No changes
          
          Show
          mightymuke Marcus Bristol added a comment - - edited There was an existing empty git repo in the temp folder. I removed it and created a .git file as suggested, manually kicked off the build, and it all worked fine. However, when initiating a build via remote polling I get this: Started on 20/03/2014 3:59:54 PM Using strategy: Default [poll] Last Built Revision: Revision be2c3d7df7fa6eb0de12b3b7b50c1180ad63cb2f (origin/master) using .gitcredentials to set credentials Could not remove the credential section from the git configuration FATAL: hudson.plugins.git.GitException: Command "git init" returned status code 128: stdout: stderr: fatal: Invalid gitfile format: C:/DOCUME~1/!SYSCA~1/LOCALS~1/Temp/.git hudson.util.IOException2: hudson.plugins.git.GitException: Command "git init" returned status code 128: stdout: stderr: fatal: Invalid gitfile format: C:/DOCUME~1/!SYSCA~1/LOCALS~1/Temp/.git at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:458) at hudson.scm.SCM._compareRemoteRevisionWith(SCM.java:356) at hudson.scm.SCM.poll(SCM.java:373) at hudson.model.AbstractProject._poll(AbstractProject.java:1584) at hudson.model.AbstractProject.poll(AbstractProject.java:1493) at hudson.triggers.SCMTrigger$Runner.runPolling(SCMTrigger.java:462) at hudson.triggers.SCMTrigger$Runner.run(SCMTrigger.java:491) at hudson.util.SequentialExecutionQueue$QueueEntry.run(SequentialExecutionQueue.java:118) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang. Thread .run(Unknown Source) Caused by: hudson.plugins.git.GitException: Command "git init" returned status code 128: stdout: stderr: fatal: Invalid gitfile format: C:/DOCUME~1/!SYSCA~1/LOCALS~1/Temp/.git at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1183) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1160) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1156) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1152) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1045) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:998) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:989) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.getHeadRev(CliGitAPIImpl.java:1535) at hudson.plugins.git.GitSCM.compareRemoteRevisionWithImpl(GitSCM.java:491) at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:456) ... 13 more Done. Took 2.6 sec No changes
          Hide
          markewaite Mark Waite added a comment -

          That message is sufficient to confirm my hunch. There is a bug in the credentials portion of the remote polling code. One way for you to avoid the bug is to add the "Force polling using workspace". I believe that will avoid the need to create the .git directory in the system temporary directory and should avoid the bug in the code.

          Show
          markewaite Mark Waite added a comment - That message is sufficient to confirm my hunch. There is a bug in the credentials portion of the remote polling code. One way for you to avoid the bug is to add the "Force polling using workspace". I believe that will avoid the need to create the .git directory in the system temporary directory and should avoid the bug in the code.
          Hide
          mightymuke Marcus Bristol added a comment -

          OK, I've added the setting - we'll see how it goes.
          Unfortunately I had to switch back from JGit as its still broken (doesn't seem to update the repository nor push changes correctly).
          Thanks for your help.

          Show
          mightymuke Marcus Bristol added a comment - OK, I've added the setting - we'll see how it goes. Unfortunately I had to switch back from JGit as its still broken (doesn't seem to update the repository nor push changes correctly). Thanks for your help.
          Hide
          mightymuke Marcus Bristol added a comment -

          The "Force polling using workspace" setting seems to have done the trick. Thanks.

          Show
          mightymuke Marcus Bristol added a comment - The "Force polling using workspace" setting seems to have done the trick. Thanks.
          Hide
          markewaite Mark Waite added a comment -

          Fixed in git-client-plugin 1.8.1

          Show
          markewaite Mark Waite added a comment - Fixed in git-client-plugin 1.8.1

            People

            • Assignee:
              ndeloof Nicolas De Loof
              Reporter:
              mightymuke Marcus Bristol
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: