Paul Peelen
Paul Peelen

Reputation: 10329

Git post-checkout hook from in repo

I am writing a post-checkout hook for git. I want this hook to be included into the repository and run directly after a fresh clone (as it does). However, I cannot add files to the .git/hooks directory in the repository.

Where do add my script in order for git to run it directly after a clone?

Sidenote:
I am aware of the security risk this adds, but I am ok with that.

Upvotes: 3

Views: 1123

Answers (1)

dimid
dimid

Reputation: 7631

You can add it anywhere in another dir and use git clone --template=[mydir] when cloning. e.g. mkdir -p ~/my_git/hooks; vi ~/my_git/hooks/post-checkout; git clone --template=~/my_git

Upvotes: 1

Related Questions