hudson+git FATAL: Could not apply tag
Asked Answered
E

4

33

I'm trying to set up hudson with git according to this article, but I still get git errors during build:

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.

How to correct those errors?

Empiric answered 19/4, 2010 at 22:15 Comment(0)
F
26

If might need both user.name and user.email.
There is actually an open ticket to set them automatically.

It might also be a Hudson server issue:

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:

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 the Hudson/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:

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:

Env: HOME=/usr/share/tomcat6/

The git plugin should now be able to successfully tag the repository and continue with the build.


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)

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:

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")

Flash answered 20/4, 2010 at 6:35 Comment(4)
See also another tutorial with softwarebloat.com/2008/11/19/…Flash
Thanks VonC for the detailed information. On my Ubuntu Hudson runs on hudson user. I just configured git name and email for hudson user and it works now.Empiric
but I don't want Git plugin to add tags to my Git repository for every build (every 15 minutes or so!). that's very weird it tags automatically by default..Canotas
I submitted issues.jenkins-ci.org/browse/JENKINS-12316 to skip tagging by default.Canotas
B
38

After installing the git plugin you can configure git name and email in Jenkins "Configure System" page...

git options in jenkins

Bolyard answered 18/5, 2011 at 14:23 Comment(1)
The git plugin solves this issue much faster than reading the comments in the answer.Haskell
F
26

If might need both user.name and user.email.
There is actually an open ticket to set them automatically.

It might also be a Hudson server issue:

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:

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 the Hudson/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:

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:

Env: HOME=/usr/share/tomcat6/

The git plugin should now be able to successfully tag the repository and continue with the build.


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)

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:

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")

Flash answered 20/4, 2010 at 6:35 Comment(4)
See also another tutorial with softwarebloat.com/2008/11/19/…Flash
Thanks VonC for the detailed information. On my Ubuntu Hudson runs on hudson user. I just configured git name and email for hudson user and it works now.Empiric
but I don't want Git plugin to add tags to my Git repository for every build (every 15 minutes or so!). that's very weird it tags automatically by default..Canotas
I submitted issues.jenkins-ci.org/browse/JENKINS-12316 to skip tagging by default.Canotas
I
2

In the new Hudson version with git plugin, you may set both: the username and the user email via the Hudson web interface options.

Inertia answered 27/7, 2011 at 16:24 Comment(0)
R
2

Or you just can disable tagging. In project configurations, under Source Code Management go to Advanced. There you can check "Skip internal Tagging"

Reticulate answered 2/10, 2013 at 9:13 Comment(1)
Updating the plugins must have added this somehow, it was not there before anyway. After removing it like you said, it worked again.Limewater

© 2022 - 2024 — McMap. All rights reserved.