0

I'm running a copy of gitlab-ce on a server of mine and I would like to do a custom pre-receive hook that searches for TODOs in the committed code and doesn't allow the push if there are any TODOs found. How can I access the committed code/files if I don't have access to git commands since I'm in the <project_name>.git directory and not in the actual code directory?

Thank you very much!

  • You don't have to be *in the actual code directory* to *have access to git commands*. Change `$PATH` if `git` is not accessible. – phd Aug 20 '18 at 10:29
  • Keep in mind server-side hooks can be dangerous. I opted to use client-side hooks + a CI. https://github.com/github/platform-samples/tree/master/pre-receive-hooks#think-twice-before-you-deploy-a-pre-receive-hook – Lovato Aug 20 '18 at 12:44
  • It's not that. I have access to git, but it tells me this: `this operation must be run in a work tree`. What I try to run is `git-diff-index` command. – Sebastian Dămian Aug 20 '18 at 12:47

0 Answers0