# Pre-checkout. clone another repo

**URL:** <https://forum.buildkite.community/t/pre-checkout-clone-another-repo/2053>\
**Category:** General\
**Created:** [May 25, 2022, 6:28am UTC](https://forum.buildkite.community/t/pre-checkout-clone-another-repo/2053 "2022-05-25T06:28:58Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![priju\_paul](https://avatars.discourse-cdn.com/v4/letter/p/839c29/32.png) [@priju\_paul](https://forum.buildkite.community/u/priju_paul)\
**Post date:** [May 25, 2022, 6:28am UTC](https://forum.buildkite.community/t/pre-checkout-clone-another-repo/2053/1 "2022-05-25T06:28:58Z")

</div>

Hi,

I need to checkout another git repo before the main repo checkout.  
How do I clone the repo in the pre-checkout stage?

Couldnt find samples for pre-checout.

Thanks

---

<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:** [May 25, 2022, 6:35am UTC](https://forum.buildkite.community/t/pre-checkout-clone-another-repo/2053/2 "2022-05-25T06:35:00Z")

</div>

Hey @priju_paul  
Do you want to skip the checkout of the configured repository or do you want to still do that, but after you’ve checked out another repository somewhere?  
There are a few plugins that can handle skipping the default checkout: [Buildkite Plugins | Integrate seamlessly with your toolkit](https://buildkite.com/plugins?filter=checkout)

In that list, there is also this one which might serve your purpose: [GitHub - hasura/smooth-checkout-buildkite-plugin: All the things you need during a Buildkite checkout 🪁](https://github.com/hasura/smooth-checkout-buildkite-plugin).

Have a look over those to see if they fit. You could reach out to the maintainers as well about adding functionality or take inspiration for your own hook.

And if they don’t fit, let us know and we can have a look into more specifics 👍

---

<div class="post-metadata">

**Author:** ![priju\_paul](https://avatars.discourse-cdn.com/v4/letter/p/839c29/32.png) [@priju\_paul](https://forum.buildkite.community/u/priju_paul)\
**Post date:** [May 25, 2022, 7:05am UTC](https://forum.buildkite.community/t/pre-checkout-clone-another-repo/2053/3 "2022-05-25T07:05:07Z")

</div>

Thanks @paula . I would want to checkout both the repositories.  
Say  
“main repo dependency” and main repo. I would want to checkout “main repo dependency” before we check out main repo.

Thanks,

---

<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:** [May 25, 2022, 7:13am UTC](https://forum.buildkite.community/t/pre-checkout-clone-another-repo/2053/4 "2022-05-25T07:13:54Z")

</div>

In that case, it looks like the smooth-checkout-buildkite-plugin should be able to do that for you. You can define a list of repos to checkout and it does them in the order defined. It overrides the default checkout so you would have to redefine it, something like this

```yaml
steps:
  - command: echo "Checks out multiple git repositories"
    plugins:
      - hasura/smooth-checkout#v3.1.0:
          repos:
            - config:
              - url: git@github.com:<username>/<repo_1>.git
                ref: <ref>
            - config:
              # check out the main repo last
              - url: $BUILDKITE_REPO

```

---

<div class="post-metadata">

**Author:** ![priju\_paul](https://avatars.discourse-cdn.com/v4/letter/p/839c29/32.png) [@priju\_paul](https://forum.buildkite.community/u/priju_paul)\
**Post date:** [June 23, 2022, 3:39am UTC](https://forum.buildkite.community/t/pre-checkout-clone-another-repo/2053/5 "2022-06-23T03:39:41Z")

</div>

Thanks @paula .

I have added the steps, however i get “🚨 Error: Failed to checkout plugin smooth-checkout: Can’t checkout plugin without a `plugins-path`”

Do we need to add the “plugins-path” as well. I reckon this is the url to smooth-checkout.

Regards

---

<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 24, 2022, 2:58am UTC](https://forum.buildkite.community/t/pre-checkout-clone-another-repo/2053/6 "2022-06-24T02:58:38Z")

</div>

That looks to me like a misconfiguration on the agent. Can you confirm you have a non-empty plugins path option? You can reference the links below to help out.

Docs for plugins-path: [Buildkite Agent configuration v3 | Buildkite Documentation](https://buildkite.com/docs/agent/v3/configuration#plugins-path)  
Error message: [https://github.com/buildkite/agent/blob/main/bootstrap/bootstrap.go#L759](https://github.com/buildkite/agent/blob/main/bootstrap/bootstrap.go#L759)
