Jenkins - Git Publisher -无法推送标签

u5rb5r59  于 2023-01-28  发布在  Git
关注(0)|答案(3)|浏览(238)

当我使用Jenkins GIT插件“Git Publisher”推送一个标签时,我得到了下面的错误,它没有给予我任何有用的信息。有人遇到过类似的问题吗?

Pushing tag mytag to repo origin
RefSpec is "refs/tags/mytag:refs/heads/mytag".
Opening connection
Counting objects
Finding sources
Writing objects
ERROR: Failed to push tag mytag to origin
hudson.plugins.git.GitException: failed to write REJECTED_OTHER_REASON for 'refs/tags/mytag:refs/heads/mytag' refspec 'mytag' to https://<ADDRESSOFSTASH>/tomtest.git
        at org.jenkinsci.plugins.gitclient.JGitAPIImpl$9.execute(JGitAPIImpl.java:1870)
        at hudson.plugins.git.GitPublisher.perform(GitPublisher.java:306)
        at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
        at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
        at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:726)
        at hudson.model.Build$BuildExecution.post2(Build.java:185)
        at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:671)
        at hudson.model.Run.execute(Run.java:1766)
        at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
        at hudson.model.ResourceController.execute(ResourceController.java:98)
        at hudson.model.Executor.run(Executor.java:408)
Build step 'Git Publisher' marked build as failure
7gcisfzg

7gcisfzg1#

我们在升级以下插件时遇到了同样的问题:

Git plugin       : from 2.4.0 to 2.4.4
Git client plugin: from 1.18.0 to 1.19.6

当我们降级到以前的版本时,问题得到了解决。

xmq68pz9

xmq68pz92#

您的Jenkins作业尝试使用如下命令将报表推送到Git存储库:

git push ssh://user@git.com/repositoryName tagName

Jenkins无法执行此操作,因为标记已存在。

ERROR: Failed to push tag tagName to repositoryName 
hudson.plugins.git.GitException: Command "git push ssh://user@git.com/repositoryName tagName" returned status code 1:
stdout: 
 ! [rejected] repositoryName -> tagName (already exists)

因此,您只需要设置强制模式:您将看到作业的配置页面。
1.请在那里找到'Git Publisher'。
1.!将“强制推送”设置为“选中”状态。
1.将“创建新标记”和“更新新标记”设置为“选中”状态。
1.再次运行此作业。

o0lyfsai

o0lyfsai3#

Jenkins作业中“创建新标记(或)更新现有标记并强制推送”
Jenkins中的解决方案是在Git Publisher插件中,通过选择创建+更新+强制推送进入“选中”状态,如下图所示。

相关问题