hudson+git 致命:无法应用标签
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2671296/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
hudson+git FATAL: Could not apply tag
提问by takeshin
I'm trying to set up hudson with git according to this article, but I still get git errors during build:
我正在尝试根据这篇文章使用 git 设置 hudson ,但是在构建过程中我仍然遇到 git 错误:
FATAL: Could not apply tag-PROJECTNAME-ID
...
Caused by: hudson.plugins.git.GitException: Command returned status code 128:
*** Please tell me who you are.
running: git config --global user.name
shows valid data, .gitconfig
is accessible.
运行:git config --global user.name
显示有效数据,.gitconfig
可访问。
How to correct those errors?
如何纠正这些错误?
采纳答案by VonC
If might need both user.name
and user.email
.
There is actually an open ticket to set them automatically.
如果可能同时需要user.name
和user.email
。
实际上有一个公开的票可以自动设置它们。
It might also be a Hudson server issue:
也可能是Hudson 服务器问题:
I was a little confused to see this message since I had already configured git to have my user name and email.
Then I remembered that Hudson is running on tomcat which is running with the tomcat6 user.
I needed to configure the tomcat6 user to have the git configuration necessary to tag on the git repositories.Setup the git configuration for the tomcat6 user by doing the following:
看到这条消息我有点困惑,因为我已经将 git 配置为拥有我的用户名和电子邮件。
然后我想起 Hudson 正在以 tomcat6 用户运行的 tomcat 上运行。
我需要将 tomcat6 用户配置为具有在 git 存储库上标记所需的 git 配置。通过执行以下操作为 tomcat6 用户设置 git 配置:
sudo -s -H -u tomcat6
git config --global user.name "Hudson"
git config --global user.email "[email protected]"
exit
As a note, if you are using Hudson to commit and push to another repository these configuration settings will be used for all commits done by Hudson.
The next step is to let Hudson know where the
HOME
is for the tomcat6 user.
On theHudson/configure
page there is a checkbox for defining environment variables.
Once it is checked you will be able to put in a key-value pair. Add the following pair and save your configuration:
请注意,如果您使用 Hudson 提交并推送到另一个存储库,这些配置设置将用于 Hudson 完成的所有提交。
下一步是让 Hudson 知道
HOME
tomcat6 用户的位置。
在Hudson/configure
页面上有一个用于定义环境变量的复选框。
一旦检查完毕,您就可以放入键值对。添加以下对并保存您的配置:
name: HOME
value: /usr/share/tomcat6/
The next time a Hudson project is built you should see the following line close to the top of the console output:
下次构建 Hudson 项目时,您应该会在靠近控制台输出顶部的位置看到以下行:
Env: HOME=/usr/share/tomcat6/
The git plugin should now be able to successfully tag the repository and continue with the build.
git 插件现在应该能够成功标记存储库并继续构建。
As mentioned here, you might have a special tomcat6 user with no account (no login allowed, with no shell: I quote "tomcat6はログイン不許可( シェルは/bin/false)ってなっている"), in which case you need to setup user.name and email on the system level)
正如这里提到的,你可能有一个没有帐户的特殊 tomcat6 用户(不允许登录,没有外壳:我引用“tomcat6はログイン不许可(シェルは/bin/false)ってなっている”),在这种情况下您需要在系统级别设置用户名和电子邮件)
git config - system user.email "kompiro @ ..."
git config --system user.name " kompiro... "
If you are using the tomcat6 user in Hudson, Hudson will need to see that user in the /etc/passwd, as mentioned here:
如果您在 Hudson 中使用 tomcat6 用户,Hudson 将需要在 /etc/passwd 中看到该用户,如下所述:
More specifically, in the
/etc/passwd
. For some reason here GIT need an entry in the field for the full name. Under Ubuntu the Tomcat user has placed there by default, nothing ("Unter Ubuntu hat der Tomcat-User dort standardm??ig nichts gesetzt.").
Adds one there now simply 'Tomcat 6,,, a
', it also runs with the CI-neighbors.
("Fügt man jetzt dort einfach 'Tomcat 6,,,
' ein, l?uft es auch mit dem CI-Nachbarn")
更具体地说,在
/etc/passwd
. 出于某种原因,GIT 需要在字段中输入全名。在 Ubuntu 下,Tomcat 用户默认放置在那里,什么都没有(“Unter Ubuntu hat der Tomcat-User dort standardm??ig nichts gesetzt.”)。
现在简单地在那里添加一个 'Tomcat 6,,, a
',它也与 CI 邻居一起运行。
(“Fügt man jetzt dort einfach 'Tomcat 6,,,
' ein, l?uft es auch mit dem CI-Nachbarn”)
回答by firegrass
After installing the git plugin you can configure git name and email in Jenkins "Configure System" page...
安装 git 插件后,您可以在 Jenkins 的“配置系统”页面中配置 git 名称和电子邮件...
回答by Sfisioza
In the new Hudson version with git plugin, you may set both: the username and the user email via the Hudson web interface options.
在带有 git 插件的新 Hudson 版本中,您可以通过 Hudson Web 界面选项同时设置:用户名和用户电子邮件。
回答by phabtar
Or you just can disable tagging. In project configurations, under Source Code Management go to Advanced. There you can check "Skip internal Tagging"
或者您可以禁用标记。在项目配置中,在源代码管理下转到高级。在那里您可以检查“跳过内部标记”