# How to skip git clone step

**URL:** <https://forum.buildkite.community/t/how-to-skip-git-clone-step/1104>\
**Category:** General\
**Created:** [June 11, 2020, 8:26am UTC](https://forum.buildkite.community/t/how-to-skip-git-clone-step/1104 "2020-06-11T08:26:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hao-Yen](https://avatars.discourse-cdn.com/v4/letter/h/e95f7d/32.png) [@Hao-Yen](https://forum.buildkite.community/u/Hao-Yen)\
**Post date:** [June 11, 2020, 8:26am UTC](https://forum.buildkite.community/t/how-to-skip-git-clone-step/1104/1 "2020-06-11T08:26:05Z")

</div>

I want to skip the git clone step at the beginning.  
I used buildkite agent on embedded linux system(armeabi) without bash and git support(only with unix shell).  
I had already tried the pre-checkout hook and the plugin from the article : [How do I skip the "Preparing Working Directory" step?](https://forum.buildkite.community/t/how-do-i-skip-the-preparing-working-directory-step/468).  
But without bash support, the pre-checkout hook will not work, and generate the error message:

> Error: Error running `/bin/bash -c /tmp/buildkite-agent-bootstrap-hook-runner-497379975`: fork/exec /bin/bash: no such file or directory

Our test binary will be sended by the scp. Is there any other way to skip the git clone step at the beginning?

---

<div class="post-metadata">

**Author:** ![anon46008679](https://avatars.discourse-cdn.com/v4/letter/a/da6949/32.png) [@anon46008679](https://forum.buildkite.community/u/anon46008679)\
**Post date:** [June 11, 2020, 8:56am UTC](https://forum.buildkite.community/t/how-to-skip-git-clone-step/1104/2 "2020-06-11T08:56:18Z")

</div>

Welcome! Hrmm it’s a good question. I think you should be able to achieve what you want by implementing the checkout hook, which will skip the git checkout (and also creating the build directory)?

---

<div class="post-metadata">

**Author:** ![deacy](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/deacy/32/816_2.png) [@deacy](https://forum.buildkite.community/u/deacy)\
**Post date:** [June 12, 2020, 6:42pm UTC](https://forum.buildkite.community/t/how-to-skip-git-clone-step/1104/3 "2020-06-12T18:42:33Z")

</div>

We actually made a simple plugin for this purpose ([uber-workflow/run-without-clone](https://github.com/uber-workflow/run-without-clone-buildkite-plugin)), but you can also use an agent checkout hook if you don’t want to add a plugin to every pipeline step

---

<div class="post-metadata">

**Author:** ![Hao-Yen](https://avatars.discourse-cdn.com/v4/letter/h/e95f7d/32.png) [@Hao-Yen](https://forum.buildkite.community/u/Hao-Yen)\
**Post date:** [June 16, 2020, 4:50am UTC](https://forum.buildkite.community/t/how-to-skip-git-clone-step/1104/4 "2020-06-16T04:50:56Z")

</div>

Thanks for @anon46008679 and @deacy. After implement the checkout hook. There still have error from bash. So I modified the buildkite agent from /bin/bash to /bin/sh(The buildkite use the /bin/bash as default, and cannot be change by the `BUILDKITE_SHELL`). Now it works well. The hooks can be run inside /bin/sh and the git clone step would be skipped.

The patch can be seen at [https://github.com/splasky/agent/commit/296176a6536b1586ce79559ba9d698c6c9a98a44](https://github.com/splasky/agent/commit/296176a6536b1586ce79559ba9d698c6c9a98a44)

---

<div class="post-metadata">

**Author:** ![anon18884907](https://avatars.discourse-cdn.com/v4/letter/a/90db22/32.png) [@anon18884907](https://forum.buildkite.community/u/anon18884907)\
**Post date:** [June 16, 2020, 6:33am UTC](https://forum.buildkite.community/t/how-to-skip-git-clone-step/1104/5 "2020-06-16T06:33:19Z")

</div>

Hey @Hao-Yen! That’s odd, the _BUILDKITE\_SHELL_ environment variable should work for changing the default shell command and flags of the agent – if it doesn’t you might have discovered a bug? Let me know if you have any other questions about this one. 😄
