开发者

How do I run a git hook when pulling changes or on the initial clone?

开发者 https://www.devze.com 2023-01-13 22:55 出处:网络
I\'m having a hard time getting a hook to run either on initial clone (this does not seem possible since the hooks don\'t get cloned anyhow) or on a simple pull.

I'm having a hard time getting a hook to run either on initial clone (this does not seem possible since the hooks don't get cloned anyhow) or on a simple pull.

I'm using git to manage a number of config files, and I need to maintain proper file ownership and perms. In my main repo, I have commit hooks set to call the "setgitperms.pl" script, and this works fine for getting the files into the repo and keeping track of the perms. The .gitmeta file gets checked out on the initial clone I run on a new box.

My problem is that I can find no git action to run after the clone that will trigger any hook. Ideally, I'd like some kind of no-op that I could run to call a hook. For example, if I could tell someone to run a sequence of commands like this to check out the repo and end up with a working copy that has the right perms, I'd be happy:

git clone git@netinstall:/var/gitrepo/conf/base.conf
cd base
tar xvzpf hooks.tgz (hooks tarball is in the repo)
git ??开发者_StackOverflow中文版?? - something that magically calls a hook with setgitperms 

I've totally been running around in circles on this one. Any ideas?


Why does it need to be invoked through a hook? Can you just call setgitperms.pl directly after doing the clone?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号