gpt4 book ai didi

git - Jenkins + git : "tell me who you are" error, 为什么要打标签?

转载 作者:IT王子 更新时间:2023-10-29 00:54:28 25 4
gpt4 key购买 nike

刚刚在 Ubuntu 12.04 中安装了 Jenkins,我想创建一个简单的构建,它只是克隆一个项目并构建它。

它失败了,因为它不能标记。它不能标记,因为它错误地说“告诉我你是谁”显然是因为我没有设置 git 设置 UserName 和 UserEmail。

但是,我不需要设置这些,Jenkins 只会克隆存储库,如果它不打算推送更改,为什么它需要凭据,为什么它根本需要做一个标签?

完整的错误日志是:

Started by user anonymous
Checkout:workspace / /var/lib/jenkins/jobs/Foo.Bar.Baz/workspace - hudson.remoting.LocalChannel@38e609c9
Using strategy: Default
Cloning the remote Git repository
Cloning repository origin
Fetching upstream changes from git@mygithost.mydomain.local:foo-bar-baz/foo-bar-baz.git
Seen branch in repository origin/1.0
Seen branch in repository origin/1.5.4
Seen branch in repository origin/HEAD
Seen branch in repository origin/master
Commencing build of Revision 479d37776b46283a946dd395c1ea78f18c0b97c7 (origin/1.0)
Checking out Revision 479d37776b46283a946dd395c1ea78f18c0b97c7 (origin/1.0)
FATAL: Could not apply tag jenkins-Foo.Bar.Baz-2
hudson.plugins.git.GitException: Could not apply tag jenkins-Foo.Bar.Baz-2
at hudson.plugins.git.GitAPI.tag(GitAPI.java:737)
at hudson.plugins.git.GitSCM$4.invoke(GitSCM.java:1320)
at hudson.plugins.git.GitSCM$4.invoke(GitSCM.java:1268)
at hudson.FilePath.act(FilePath.java:758)
at hudson.FilePath.act(FilePath.java:740)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1268)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1193)
at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:565)
at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:453)
at hudson.model.Run.run(Run.java:1376)
at hudson.matrix.MatrixBuild.run(MatrixBuild.java:220)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:175)
at hudson.model.OneOffExecutor.run(OneOffExecutor.java:66)
Caused by: hudson.plugins.git.GitException: Command "git tag -a -f -m Jenkins Build #2 jenkins-Foo.Bar.Baz-2" returned status code 128:
stdout:
stderr:
*** Please tell me who you are.

Run

git config --global user.email "you@example.com"
git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: empty ident <jenkins@somehostname.(none)> not allowed

at hudson.plugins.git.GitAPI.launchCommandIn(GitAPI.java:786)
at hudson.plugins.git.GitAPI.launchCommand(GitAPI.java:748)
at hudson.plugins.git.GitAPI.launchCommand(GitAPI.java:758)
at hudson.plugins.git.GitAPI.tag(GitAPI.java:735)
... 13 more

最佳答案

在提取/克隆 repo 时标记的想法对于大多数 Build Scheduler 都很常见:
Hudson-Jenkins,还有CruiseControl (构建标签由 labelincrementer 决定),或 RTC Jazz Build Engine (where they are called "snapshots") .

想法是将输入的持久记录设置为构建。
这样,您 pull 的代码(即使未标记)也会由构建调度程序自动为您标记,以便稍后能够返回到该特定构建。

如果设置了该策略(总是在构建之前标记),那么 Jenkins 将需要知道你是谁才能创建一个 git 标记(它是一个附加了作者的 git 对象:user。姓名user.email)。

但是,如“Why hudson/jenkins tries to make commit?”中所述:

Checks "Skip internal tag" config under "Advanced..." in section "Source code management".

这应该避免您似乎不需要的额外标记步骤。

enter image description here

关于git - Jenkins + git : "tell me who you are" error, 为什么要打标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11122913/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com