嗨,当我尝试在Jenkins中构建项目时,出现此错误。
Started by user jenkins
Building in workspace /var/lib/jenkins/workspace/booking-widget-api
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://xxx@bitbucket.org/yyy/repo-name.git # timeout=10
Fetching upstream changes from https://xxx@bitbucket.org/yyy/repo-name.git
> git --version # timeout=10
using GIT_ASKPASS to set credentials
> git fetch --tags --progress https://xxx@bitbucket.org/yyy/repo-name.git +refs/heads/*:refs/remotes/origin/*
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from https://xxx@bitbucket.org/yyy/repo-name.git
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:888)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1155)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1186)
at hudson.scm.SCM.checkout(SCM.java:504)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1208)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:574)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499)
at hudson.model.Run.execute(Run.java:1794)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress https://xxx@bitbucket.org/yyy/repo-name.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout:
stderr: remote: Counting objects: 8, done.
remote: Compressing objects: 12% (1/8)
remote: Compressing objects: 25% (2/8)
remote: Compressing objects: 37% (3/8)
remote: Compressing objects: 50% (4/8)
remote: Compressing objects: 62% (5/8)
remote: Compressing objects: 75% (6/8)
remote: Compressing objects: 87% (7/8)
remote: Compressing objects: 100% (8/8)
remote: Compressing objects: 100% (8/8), done.
remote: Total 8 (delta 5), 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:2002)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1721)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:72)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:405)
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:886)
... 11 more
ERROR: Error fetching remote repo 'origin'
Finished: FAILURE
第一次出现此错误。我只是放弃了一段时间(一天)。然后,我构建了该项目,该项目正常运行并成功构建。现在我再次收到此错误。有人会面对这种问题吗?
答案 0 :(得分:2)
在寻找相同的解决方案时偶然发现了这个主题。
我们拥有这个Jenkins多分支管道,该管道已经存在了很长时间。一天,它开始失败并出现相同的错误。
Fetching origin...
Fetching upstream changes from origin
> git --version # timeout=10
> git config --get remote.origin.url # timeout=10
using GIT_ASKPASS to set credentials
> git fetch --tags --progress origin +refs/heads/*:refs/remotes/origin/*
hudson.plugins.git.GitException: Command "git fetch --tags --progress origin +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout:
stderr: Authorized uses only. All activity may be monitored and reported
remote: Counting objects: 82, done.
remote: Compressing objects: 1% (1/54)
remote: Compressing objects: 3% (2/54)
remote: Compressing objects: 5% (3/54)
remote: Compressing objects: 7% (4/54)
remote: Compressing objects: 9% (5/54)
remote: Compressing objects: 11% (6/54)
remote: Compressing objects: 12% (7/54)
remote: Compressing objects: 14% (8/54)
remote: Compressing objects: 16% (9/54)
remote: Compressing objects: 18% (10/54)
remote: Compressing objects: 20% (11/54)
remote: Compressing objects: 22% (12/54)
remote: Compressing objects: 24% (13/54)
remote: Compressing objects: 25% (14/54)
remote: Compressing objects: 27% (15/54)
remote: Compressing objects: 29% (16/54)
remote: Compressing objects: 31% (17/54)
remote: Compressing objects: 33% (18/54)
remote: Compressing objects: 35% (19/54)
remote: Compressing objects: 37% (20/54)
remote: Compressing objects: 38% (21/54)
remote: Compressing objects: 40% (22/54)
remote: Compressing objects: 42% (23/54)
remote: Compressing objects: 44% (24/54)
remote: Compressing objects: 46% (25/54)
remote: Compressing objects: 48% (26/54)
remote: Compressing objects: 50% (27/54)
remote: Compressing objects: 51% (28/54)
remote: Compressing objects: 53% (29/54)
remote: Compressing objects: 55% (30/54)
remote: Compressing objects: 57% (31/54)
remote: Compressing objects: 59% (32/54)
remote: Compressing objects: 61% (33/54)
remote: Compressing objects: 62% (34/54)
remote: Compressing objects: 64% (35/54)
remote: Compressing objects: 66% (36/54)
remote: Compressing objects: 68% (37/54)
remote: Compressing objects: 70% (38/54)
remote: Compressing objects: 72% (39/54)
remote: Compressing objects: 74% (40/54)
remote: Compressing objects: 75% (41/54)
remote: Compressing objects: 77% (42/54)
remote: Compressing objects: 79% (43/54)
remote: Compressing objects: 81% (44/54)
remote: Compressing objects: 83% (45/54)
remote: Compressing objects: 85% (46/54)
remote: Compressing objects: 87% (47/54)
remote: Compressing objects: 88% (48/54)
remote: Compressing objects: 90% (49/54)
remote: Compressing objects: 92% (50/54)
remote: Compressing objects: 94% (51/54)
remote: Compressing objects: 96% (52/54)
remote: Compressing objects: 98% (53/54)
remote: Compressing objects: 100% (54/54)
remote: Compressing objects: 100% (54/54), done.
remote: Total 82 (delta 16), 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:2042)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1761)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$400(CliGitAPIImpl.java:72)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:442)
at jenkins.plugins.git.AbstractGitSCMSource.doRetrieve(AbstractGitSCMSource.java:351)
at jenkins.plugins.git.AbstractGitSCMSource.retrieve(AbstractGitSCMSource.java:374)
at jenkins.scm.api.SCMSource.fetch(SCMSource.java:583)
at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:98)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:293)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Finished: FAILURE
我的同事建议从项目存储库URL中删除.git
---起作用了!
我们仍然没有找到它起作用的原因,但是是的。
答案 1 :(得分:0)
基于此错误:
error: insufficient permission for adding an object to repository database .git/objects
您可能想看看:
Git Push Error: insufficient permission for adding an object to repository database
可能想查看一些权限。
答案 2 :(得分:0)
重新配置Jenkins作业
在我们的案例中,以下帮助:
为什么它一直在工作,而jenkins / bitbucket / jenkins的工作却没有变化-不知道。
此功能的描述如下:
如果选择,请尝试直接从以下位置获取管道脚本内容 SCM,而不执行完整的结帐。这种模式的优势 是它的效率;但是,您将不会获得任何变更日志或轮询 基于SCM。 (如果您在构建过程中使用checkout scm,这将 填充变更日志并初始化轮询。)同时构建参数 在这种模式下不会被替换为SCM配置。只要 选定的SCM插件支持此模式。