Jenkins insufficient permission for adding an object to repository database

最近遇到一个“古怪的“Jenkins git clone问题,明明有权限,credential也是对的,但是Jenkins pipeline 就是clone不下来代码,报权限不足的错误。详细的错误信息见最后。

更郁闷的是,原来是好好的,突然就不行了。

查了网上一些文章,说可能的原因有:

  • 磁盘空间不足 (检查了,磁盘空间还有很多)
  • 权限问题 (试了直接在Jenkins server上和本地都可以clone成功)
  • 建议在Pipeline script from SCM的Additional behavior上加上 “Wipe out
    repository & force clone” (试过了也不行)

    最后的解决办法是在Pipeline script from SCM的最后取消勾选”Lightweight checkout“,让Jenkins pipeline每次都直接从repository上clone下来pipeline script。

Jenkins 上的”Lightweight checkout”选项的解释如下:

If selected, try to obtain the Pipeline script contents directly from
the SCM without performing a full checkout. The advantage of this mode
is its efficiency; however, you will not get any changelogs or polling
based on the SCM. (If you use checkout scm during the build, this will
populate the changelog and initialize polling.) Also build parameters
will not be substituted into SCM configuration in this mode. Only
selected SCM plugins support this mode.

详细错误信息:

[BFA] Scanning build for known causes… [BFA] No failure causes found
[BFA] Done. 0s hudson.plugins.git.GitException: Command “/usr/bin/git
fetch –tags –progress origin +refs/heads/dev:refs/remotes/origin/dev
–prune” 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 11),
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:1996)
at
org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1715)
at
org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access300(CliGitAPIImpl.java:72)atorg.jenkinsci.plugins.gitclient.CliGitAPIImpl1.execute(CliGitAPIImpl.java:405)
at
jenkins.plugins.git.GitSCMFileSystem$BuilderImpl.build(GitSCMFileSystem.java:351)
at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:196) at
jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:172) at
org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:108)
at
org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:67)
at
org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:271)
at
hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429) Finished: FAILURE

阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页