# Custom repository hook location

**URL:** <https://forum.buildkite.community/t/custom-repository-hook-location/2081>\
**Category:** Features Requests\
**Created:** [June 6, 2022, 8:57pm UTC](https://forum.buildkite.community/t/custom-repository-hook-location/2081 "2022-06-06T20:57:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gcmn](https://avatars.discourse-cdn.com/v4/letter/g/858c86/32.png) [@gcmn](https://forum.buildkite.community/u/gcmn)\
**Post date:** [June 6, 2022, 8:57pm UTC](https://forum.buildkite.community/t/custom-repository-hook-location/2081/1 "2022-06-06T20:57:08Z")

</div>

In our project, we put all our build tool configuration stuff in a top-level build\_tools directory. This helps to keep infrastructure organized separately from the core source code and avoids cluttering the landing page when someone first visits the repository. It looks like Buildkite repository hooks _have_ to go in “.buildkite/hooks” at the root of the repo ([docs](https://buildkite.com/docs/agent/v3/hooks#hook-locations:~:text=from%20any%20pipeline.-,Repository%20hooks,-%2D%20these%20exist%20in)). I see this is currently hardcoded in the [agent bootstrap](https://github.com/buildkite/agent/blob/1598e4ff55/bootstrap/bootstrap.go#L390). Could it instead be moved into the agent config?

(for now, I’ve just added a symlink)

---

<div class="post-metadata">

**Author:** ![paula](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/paula/32/954_2.png) [@paula](https://forum.buildkite.community/u/paula)\
**Post date:** [June 6, 2022, 9:40pm UTC](https://forum.buildkite.community/t/custom-repository-hook-location/2081/2 "2022-06-06T21:40:54Z")

</div>

Hey @gcmn!

The agent hooks exist on the agent file system and it’s configured by the [hooks-path](https://buildkite.com/docs/agent/v3/configuration#hooks-path) setting. I believe you can set it to your new location.  
By default, you can find the location of the agent hooks directory in your [platform’s installation documentation](https://buildkite.com/docs/agent/v3/installation). Then during the agent’s startup, you can pass the `hooks-path` as shown below:  
`buildkite-agent start --hooks-path ~/.new-buildkite-agent-dire/hooks`

Best!

---

<div class="post-metadata">

**Author:** ![gcmn](https://avatars.discourse-cdn.com/v4/letter/g/858c86/32.png) [@gcmn](https://forum.buildkite.community/u/gcmn)\
**Post date:** [June 6, 2022, 9:49pm UTC](https://forum.buildkite.community/t/custom-repository-hook-location/2081/3 "2022-06-06T21:49:33Z")

</div>

Yeah that’s for the _agent_ hooks that are installed on the agents. I’m talking about the repo hooks that are triggered in the job lifecycle for every job that checks out the repository.

---

<div class="post-metadata">

**Author:** ![paula](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/paula/32/954_2.png) [@paula](https://forum.buildkite.community/u/paula)\
**Post date:** [June 6, 2022, 10:02pm UTC](https://forum.buildkite.community/t/custom-repository-hook-location/2081/4 "2022-06-06T22:02:31Z")

</div>

Oh right! I misread 😅

It’s a good suggestion 👍🏻. Can you also create an issue on the agent [repo](https://github.com/buildkite/agent)? So the maintainers of the repo can provide you with feedback. And if you are willing to create a PR would be much appreciated! 😊

Best!

---

<div class="post-metadata">

**Author:** ![gcmn](https://avatars.discourse-cdn.com/v4/letter/g/858c86/32.png) [@gcmn](https://forum.buildkite.community/u/gcmn)\
**Post date:** [June 7, 2022, 12:35am UTC](https://forum.buildkite.community/t/custom-repository-hook-location/2081/5 "2022-06-07T00:35:14Z")

</div>

Filed [Make location of repository hooks configurable · Issue #1668 · buildkite/agent · GitHub](https://github.com/buildkite/agent/issues/1668)
