[JIRA] (JENKINS-41169) git init fails on Windows slave due to unwritable .git\config-file

2 views
Skip to first unread message

mattias.vannergard@gmail.com (JIRA)

unread,
Jan 18, 2017, 7:02:01 AM1/18/17
to jenkinsc...@googlegroups.com
Mattias Vannergård created an issue
 
Jenkins / Bug JENKINS-41169
git init fails on Windows slave due to unwritable .git\config-file
Issue Type: Bug Bug
Assignee: Mark Waite
Components: git-client-plugin, git-plugin
Created: 2017/Jan/18 12:01 PM
Environment: Jenkins 2.39.1 LTS, GitLab 8.15.4, Git 2.8.4, Git plugin 3.0.1, Git client plugin 2.2.1.
Server running on Ubuntu 16.04 LTS and Slave running on Win 7.
Labels: plugin
Priority: Major Major
Reporter: Mattias Vannergård

Sometimes, the git init-command fails because of the .git/config-file is non-writeable.
Logging into the slave, there seems to be nothing wrong with the permissions on the file.

When it is good, it just inits the repo.

12:33:36 Started by GitLab push by the_persion
12:33:36 [EnvInject] - Loading node environment variables.
12:33:36 Building remotely on the_machine in workspace C:\JenkinsVM_slave\workspace\the_job
12:33:36 [WS-CLEANUP] Deleting project workspace...
12:33:38 [WS-CLEANUP] Done
12:33:41 Wiping out workspace first.
12:33:41 Cloning the remote Git repository
12:33:41 Cloning repository the_repository.git
12:33:41  > git init C:\JenkinsVM_slave\workspace\the_job # timeout=10
12:33:41 Fetching upstream changes from the_repository.git

When it fails, it halts at git init:

11:38:32 Started by GitLab push by the_person
11:38:32 [EnvInject] - Loading node environment variables.
11:38:32 Building remotely on the_machine in workspace C:\JenkinsVM_slave\workspace\the_job
11:38:32 [WS-CLEANUP] Deleting project workspace...
11:38:32 [WS-CLEANUP] Done
11:38:32 Wiping out workspace first.
11:38:32 Cloning the remote Git repository
11:38:32 Cloning repository the_repository.git
11:38:32  > git init C:\JenkinsVM_slave\workspace\the_job # timeout=10
11:38:33 ERROR: Error cloning remote repo 'origin'
11:38:33 hudson.plugins.git.GitException: Could not init C:\JenkinsVM_slave\workspace\the_job
11:38:33 	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:666)
11:38:33 	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:467)
11:38:33 	at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:152)
11:38:33 	at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:145)
11:38:33 	at hudson.remoting.UserRequest.perform(UserRequest.java:153)
11:38:33 	at hudson.remoting.UserRequest.perform(UserRequest.java:50)
11:38:33 	at hudson.remoting.Request$2.run(Request.java:332)
11:38:33 	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
11:38:33 	at java.util.concurrent.FutureTask.run(Unknown Source)
11:38:33 	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
11:38:33 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
11:38:33 	at hudson.remoting.Engine$1$1.run(Engine.java:85)
11:38:33 	at java.lang.Thread.run(Unknown Source)
11:38:33 	at ......remote call to Channel to /ip_address_of_the_machine(Native Method)
11:38:33 	at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1537)
11:38:33 	at hudson.remoting.UserResponse.retrieve(UserRequest.java:253)
11:38:33 	at hudson.remoting.Channel.call(Channel.java:822)
11:38:33 	at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:145)
11:38:33 	at sun.reflect.GeneratedMethodAccessor132.invoke(Unknown Source)
11:38:33 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
11:38:33 	at java.lang.reflect.Method.invoke(Method.java:498)
11:38:33 	at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:131)
11:38:33 	at com.sun.proxy.$Proxy73.execute(Unknown Source)
11:38:33 	at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1054)
11:38:33 	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1094)
11:38:33 	at hudson.scm.SCM.checkout(SCM.java:495)
11:38:33 	at hudson.model.AbstractProject.checkout(AbstractProject.java:1278)
11:38:33 	at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604)
11:38:33 	at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
11:38:33 	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
11:38:33 	at hudson.model.Run.execute(Run.java:1728)
11:38:33 	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
11:38:33 	at hudson.model.ResourceController.execute(ResourceController.java:98)
11:38:33 	at hudson.model.Executor.run(Executor.java:404)
11:38:33 Caused by: hudson.plugins.git.GitException: Command "git init C:\JenkinsVM_slave\workspace\the_job" returned status code 128:
11:38:33 stdout: 
11:38:33 stderr: error: could not write config file C:/JenkinsVM_slave/workspace/the_job/.git/config: Permission denied
11:38:33 fatal: could not set 'core.symlinks' to 'false'
11:38:33 
11:38:33 	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1772)
11:38:33 	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1745)
11:38:33 	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1741)
11:38:33 	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1412)
11:38:33 	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:664)
11:38:33 	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:467)
11:38:33 	at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:152)
11:38:33 	at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:145)
11:38:33 	at hudson.remoting.UserRequest.perform(UserRequest.java:153)
11:38:33 	at hudson.remoting.UserRequest.perform(UserRequest.java:50)
11:38:33 	at hudson.remoting.Request$2.run(Request.java:332)
11:38:33 	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
11:38:33 	at java.util.concurrent.FutureTask.run(Unknown Source)
11:38:33 	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
11:38:33 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
11:38:33 	at hudson.remoting.Engine$1$1.run(Engine.java:85)
11:38:33 	at java.lang.Thread.run(Unknown Source)
11:38:33 ERROR: null

Note that the fatal error at 11:38:33 could not set 'core.symlink' to 'true', can be almost any entity in the config-file. Not necessarily the same from time to time.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

mark.earl.waite@gmail.com (JIRA)

unread,
Jan 18, 2017, 7:07:01 AM1/18/17
to jenkinsc...@googlegroups.com
Mark Waite assigned an issue to Unassigned
Change By: Mark Waite
Assignee: Mark Waite

mark.earl.waite@gmail.com (JIRA)

unread,
Jan 18, 2017, 7:11:01 AM1/18/17
to jenkinsc...@googlegroups.com
Mark Waite commented on Bug JENKINS-41169
 
Re: git init fails on Windows slave due to unwritable .git\config-file

Since the failing command is a call from command line `git init` and the failure is likely caused by the Windows operating system refusing to create a file, I doubt there is much which the plugin can do to fix the issue.

You may want to investigate virus scanners to see if there are retaining locks on files or directories longer than expected.

Alternately, you might check to see if the behavior changes if you switch from using "Wipe Workspace" to "Clean workspace".

mattias.vannergard@gmail.com (JIRA)

unread,
Jan 18, 2017, 7:25:01 AM1/18/17
to jenkinsc...@googlegroups.com

Sorry, I should have added that these problems started when we upgraded Git from 2.7.4 to 2.8.4, and the Git client plugin from 2.1.0 to 2.2.0.
Since a lot of work was done on the CliGitAPIImpl.java for the submodules, I thought that maybe this is some kind of forseen side-effect.

mattias.vannergard@gmail.com (JIRA)

unread,
Jan 18, 2017, 8:53:01 AM1/18/17
to jenkinsc...@googlegroups.com

It seems like it is actually Git for Windows 2.8.4 that is at fault here.
Doing
git init test
rm -rf test
very fast, over and over again, reproduces an error where config.lock is left despite 'rm -rf test' is completed.

Let's close this issue.

mattias.vannergard@gmail.com (JIRA)

unread,
Jan 18, 2017, 8:54:01 AM1/18/17
to jenkinsc...@googlegroups.com
Mattias Vannergård closed an issue as Not A Defect
 

It seems to be a defect with Git for Windows 2.8.4, not the git-plugin client.

Change By: Mattias Vannergård
Status: Open Closed
Resolution: Not A Defect

mattias.vannergard@gmail.com (JIRA)

unread,
Feb 17, 2017, 4:38:03 AM2/17/17
to jenkinsc...@googlegroups.com
 
Re: git init fails on Windows slave due to unwritable .git\config-file

It happened again with Git for Windows 2.10.2.

My conclusion is that it is the Additional Behvaiour "Wipe out repository before clone" and "Clean before checkout" that has some timing problem on Git for Windows.

I found an acceptable workaround:
Adding a "rm -rf .git" in Prepare environment for the run, and having it cooperate with Delete workspace before build starts in the Build Environment, actually does the trick of a clean workspace, where git init works.

mattias.vannergard@gmail.com (JIRA)

unread,
Feb 17, 2017, 4:38:03 AM2/17/17
to jenkinsc...@googlegroups.com
Mattias Vannergård reopened an issue
 
Change By: Mattias Vannergård
Resolution: Not A Defect
Status: Closed Reopened

mattias.vannergard@gmail.com (JIRA)

unread,
Feb 17, 2017, 4:44:01 AM2/17/17
to jenkinsc...@googlegroups.com
 
Re: git init fails on Windows slave due to unwritable .git\config-file

I can also add, that I used the Naginator, to re-init and re-clone once, if it fails. And that worked, too, but was somewhat cumbersome with e-mails on fail, success all the time...

mark.earl.waite@gmail.com (JIRA)

unread,
Mar 20, 2017, 2:30:02 AM3/20/17
to jenkinsc...@googlegroups.com
Mark Waite resolved as Won't Fix
 

Closed as "won't fix" because it is specific to command line git and Windows, only related to the git plugin because the git plugin performs operations in rapid succession.

Change By: Mark Waite
Status: Reopened Resolved
Resolution: Won't Fix
This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)
Atlassian logo

mark.earl.waite@gmail.com (JIRA)

unread,
Oct 22, 2019, 9:30:58 PM10/22/19
to jenkinsc...@googlegroups.com
Mark Waite closed an issue as Won't Fix
Change By: Mark Waite
Status: Resolved Closed
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages