CS FundamentalsHardProduct-company DevOps interview

A team lead adds a pre-commit hook to .git/hooks/pre-commit in her repository and pushes. Teammates who clone the repository report that the hook never runs. What is the explanation?

  1. A. Hooks run only on the server
  2. B. The .git/hooks folder is not part of the versioned content, so clones do not get it; the team should version a hooks folder (e.g. via core.hooksPath or a hook manager) and also enforce the checks in CI
  3. C. Hooks must be written in Python
  4. D. The hook runs only after git push

Correct answer: B. The .git/hooks folder is not part of the versioned content, so clones do not get it; the team should version a hooks folder (e.g. via core.hooksPath or a hook manager) and also enforce the checks in CI

Client-side hooks live in .git, which is never pushed or cloned. Sharing them needs a versioned script folder plus setup; and because hooks can be skipped with --no-verify, CI must enforce the same checks.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic