Reputation: 1783
I have a CentOS server that has a Git server in it. When a user is running git push
, I want to get the user.name
of his config. Is it possible to get that within the hooks like update
or pre-receive
file?
Upvotes: 0
Views: 522
Reputation: 488213
You can't. The user.name
setting is irrelevant anyway, since it's not necessarily the name of the person running git push
; what matter are:
If I make two commits in a row with faked names:
... change stuff and git add ...
git -c user.name=great -c [email protected] commit -m "great"
... change stuff and git add ...
git -c user.name=gatsby -c [email protected] commit -m "gatsby"
and then run git push
with a third faked name:
git -c user.name=fitzgerald push origin master
what do you intend to do with the three names I've supplied?
In any case, the client-side user.name
setting is simply not available to the server. Since it can be so easily faked (see above), git push
does not bother to supply it.
Upvotes: 0