Jenkins + git:"告诉我你是谁"错误,为什么需要标记?

kno*_*cte 36 git jenkins jenkins-plugins

刚刚在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
Run Code Online (Sandbox Code Playgroud)

Von*_*onC 37

拉动/克隆仓库时标记的想法对于大多数Build Scheduler来说都很常见:
Hudson-Jenkins,还有CruiseControl(由它确定的构建标签labelincrementer),或者RTC Jazz Build Engine(它们被称为"快照").

我们的想法是为构建设置输入的持久记录.
这样,您正在拉动的代码,即使它没有被标记,也会由构建调度程序自动为您标记,以便以后能够返回到该特定构建.

如果设置了该策略(始终在构建之前进行标记),那么Jenkins将需要知道您是谁以制作git标记(它是附加了作者的git对象:user.nameuser.email).

但是,如" 为什么hudson/jenkins尝试提交? "中所述:

检查" Skip internal tag" Advanced...部分" Source code management"中的" "配置.

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

在此输入图像描述


iec*_*fly 21

至于如何设置user.email和user.name,在jenkins中,转到"Manage Jenkins">"Configure System"并向下滚动到"Git plugin",你会发现 Git插件屏幕截图

输入你的电子邮件和名字,你很高兴.

  • 我有那套,但似乎没有使用. (3认同)