Jenkins and Git - how to grab a committer's name?

I don't know why some of the variables are available and some aren't but it seems you're not the only one with that problem (see e.g. Git plugin for Jenkins: How do I set env variables GIT_AUTHOR_EMAIL and GIT_COMMITTER_EMAIL?).

Use e.g. git show -s --pretty=%an to obtain the author name and store it in a variable via command substitution as explained by @MattKneiser:

foo=$(git show -s --pretty=%an)

This variable won't be available in other shell steps in your Jenkins job, but you could save it to a file in your workspace,

echo "foo=\"$foo\"" > $WORKSPACE/envvars

and later source that file in the other shell:

. $WORKSPACE/envvars

Tags:

Git

Jenkins