1

I have a commit-msg where I use GIT_AUTHOR_NAME for whitelisting specific developers for certain commit message standards. In normal scenarios, GIT_AUTHOR_NAME is always defined and shows the correct author of the commit. When I am doing a release with these steps below

git checkout -b release/1.2.0 develop
git checkout master
git merge --no-ff release/1.2.0

git opens an internal message prompt for the merges.

Merge branch 'release/1.2.0'
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.

After I save it and exit, inside my commit-msg hook the GIT_AUTHOR_NAME and GIT_COMMITTER_NAME are both empty. And not only those values, but also the email, date, and any other author-related variable.

What's the problem here?

3
  • How do you set GIT_AUTHOR_NAME? Do you use sudo?
    – phd
    Feb 25 at 19:59
  • It's set by git. git-scm.com/book/en/v2/Git-Internals-Environment-Variables - Check it. Feb 26 at 14:48
  • 1
    From the linked text: "Some of Git’s general behavior as a computer program depends on environment variables." That is Git doesn't set these variables, it expects you set them and then Git uses their values.
    – phd
    Feb 26 at 15:25

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.