首页 > 代码库 > jenkins和gitlab结合的时候出错

jenkins和gitlab结合的时候出错

Started by user zhaoliang
Building in workspace /var/lib/jenkins/workspace/ZuoYeah_Static_Production
 > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url git@gitlab.com:tiplus_cn/zuoyeah_static.git # timeout=10
Fetching upstream changes from git@gitlab.com:tiplus_cn/zuoyeah_static.git
 > git --version # timeout=10
using GIT_SSH to set credentials 
 > git -c core.askpass=true fetch --tags --progress git@gitlab.com:tiplus_cn/zuoyeah_static.git +refs/heads/*:refs/remotes/origin/*
ERROR: Error fetching remote repo ‘origin‘
hudson.plugins.git.GitException: Failed to fetch from git@gitlab.com:tiplus_cn/zuoyeah_static.git
	at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:763)
	at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1012)
	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1043)
	at hudson.scm.SCM.checkout(SCM.java:485)
	at hudson.model.AbstractProject.checkout(AbstractProject.java:1277)
	at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:610)
	at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:532)
	at hudson.model.Run.execute(Run.java:1741)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
	at hudson.model.ResourceController.execute(ResourceController.java:98)
	at hudson.model.Executor.run(Executor.java:408)
Caused by: hudson.plugins.git.GitException: Command "git -c core.askpass=true fetch --tags --progress git@gitlab.com:tiplus_cn/
zuoyeah_static.git +refs/heads/*:refs/remotes/origin/*" returned status code 128: stdout: stderr: remote: Counting objects: 18, done. remote: Compressing objects: 5% (1/18)  remote: Compressing objects: 11% (2/18)  remote: Compressing objects: 16% (3/18)  remote: Compressing objects: 22% (4/18)  remote: Compressing objects: 27% (5/18)  remote: Compressing objects: 33% (6/18)  remote: Compressing objects: 38% (7/18)  remote: Compressing objects: 44% (8/18)  remote: Compressing objects: 50% (9/18)  remote: Compressing objects: 55% (10/18)  remote: Compressing objects: 61% (11/18)  remote: Compressing objects: 66% (12/18)  remote: Compressing objects: 72% (13/18)  remote: Compressing objects: 77% (14/18)  remote: Compressing objects: 83% (15/18)  remote: Compressing objects: 88% (16/18)  remote: Compressing objects: 94% (17/18)  remote: Compressing objects: 100% (18/18)  remote: Compressing objects: 100% (18/18), done. remote: Total 18 (delta 12), reused 0 (delta 0) error: insufficient permission for adding an object to repository database .git/objects fatal: failed to write object fatal: unpack-objects failed at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1640) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1388) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:62) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:313) at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:761) ... 11 more ERROR: null Finished: FAILURE


原因是我在服务器进行了操作,然后在/var/lib/jenkins/workspace/ZuoYeah_Static_Production/.git/objects目录中 无意中增加了root账号权限的文件夹,原来是jenkins账号的文件权限是jenkins,所以需要将objects目录下的文件夹权限组修改为jenkins

jenkins和gitlab结合的时候出错