views:

383

answers:

1

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?

+3  A: 

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

VonC
See also another tutorial with http://www.softwarebloat.com/2008/11/19/continuous-integration-blueprints-how-to-build-an-army-of-killer-robots-with-hudson-and-cucumber/
VonC
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.
takeshin