Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins + git: "tell me who you are" error, why does it need to tag?

Just installed Jenkins in Ubuntu 12.04 and I wanted to create a simple build that just clones a project and builds it.

It fails because it cannot tag. It cannot tag because it errors out saying "tell me who you are" apparently because I didn't set git settings UserName and UserEmail.

But, I should not need to set those, Jenkins is going to just clone the repository, why does it need the credentials if it's not going to push changes, why does it need to do a tag at all?

Full error log is:

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 [email protected]: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 "[email protected]"   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 
like image 777
knocte Avatar asked Jun 20 '12 15:06

knocte


People also ask

Does Jenkins poll commit Git?

The git plugin provides fundamental git operations for Jenkins projects. It can poll, fetch, checkout, branch, list, merge, tag, and push repositories.

How do you configure git in Jenkins?

Go to Jenkins dashboard, click on “Manage Jenkins.” Now follow these steps- Manage Plugins -> 'Available' tab -> Enter Git in search bar and filter -> Install required plugin. After the installation, all you need to do is click on “Configure System” and go to the 'GitHub' section.


2 Answers

The idea of tagging when pulling/cloning a repo is common to most Build Scheduler out there:
Hudson-Jenkins, but also CruiseControl (The build label determined by the labelincrementer), or RTC Jazz Build Engine (where they are called "snapshots").

The idea is to set a persistent record of the input to a build.
That way, the code you are pulling, even if it wasn't tagged, is tagged automatically for you by the build scheduler, in order to be able to get back to that specific build later.

If that policy (always tagging before a build) is set, then Jenkins will need to know who you are in order to make a git tag (it is a git object with an author attached to it: user.name and user.email).

However, as mentioned in " Why hudson/jenkins tries to make commit? ":

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

That should avoid that extra tagging step you appear to not need.

enter image description here

like image 151
VonC Avatar answered Oct 07 '22 01:10

VonC


As for how to set user.email and user.name, In jenkins, go to "Manage Jenkins" > "Configure System" and scroll down to "Git plugin" and there you will find Git plugin screen shot

enter your email and name, you're good to go.

like image 32
iecanfly Avatar answered Oct 07 '22 01:10

iecanfly