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

后端 未结 2 639
猫巷女王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:37

    You don't.
    The upstream repo doesn't make any assumption about who is providing commit: it can be through email, a diff patch copied on a USB key, and other various transfer protocol.

    Some of those protocols (ssh, https) might have in their logs the information you seek, but:

    • this has nothing to do with Git
    • this suppose their log level is appropriately set.
    • even for Gitolite, the name of the public ssh key registered in the gitolite-admin repo can be anything you want, and not related to a real name.

    As Linus mentions (in "Why do some open source projects do not accept pull requests, but emailing patch files only?"):

    since github identities are random, I expect the pull request to be a signed tag, so that I can verify the identity of the person in question.

    So if you want, as someone pushing some commits, to vouch for the integrity of the all repo, you can make and sign a tag on the HEAD of what is being pushed, in order for the upstream repo to consider you as, not exactly the "pusher", but the one validating what has been pushed

提交回复
热议问题