What user runs the git hook?

后端 未结 2 918
梦毁少年i
梦毁少年i 2020-12-29 21:05

I have a post-update hook on my server, such that when I

git push

it does a pull on the live web directory. However, while the push always

2条回答
  •  误落风尘
    2020-12-29 22:06

    The hooks are run as the user doing the push. If you have some kind of pre-made setup, that may be a user like git or gitosis, or it may be you. Just look at how you have the remote configured. (git remote show or just examine .git/config if you don't know) Presumably you're pushing via SSH, and there's a username@hostname in the URL.

    P.S. It's pretty quick to demonstrate this - just clone a repo locally, throw a post-update hook in with an echo $USER or something similar, and try pushing as yourself or a different user (directly or through ssh).

提交回复
热议问题