How to get pusher's Information in post-receive hooks?

后端 未结 2 654
猫巷女王i
猫巷女王i 2021-01-18 07:09

Author, Committer and Pusher can be different person in Git, but git didn\'t store the pusher\'s information in logs.

So, How do i get it?

2条回答
  •  独厮守ぢ
    2021-01-18 07:49

    If the push is happening over SSH, you may be able to use the USER environment variable. (This will also work for local pushes, of course.) This depends, of course, on whether the user that is used for SSH login is distinct for different users of your system - this isn't the case with gitolite, for example. (However, gitolite will define the GL_USER environment variable to identify the pusher.) For HTTP, you can try the REMOTE_USER environment variable.

    Update: In general, this information isn't terribly interesting compared to the author and committer of the commits - it's always a surprise to me, for example, that GitHub displays the user who did particular pushes at all...

提交回复
热议问题