# Git clone step is very slow

**URL:** <https://discuss.bitrise.io/t/git-clone-step-is-very-slow/3844>\
**Category:** Builds\
**Created:** [January 23, 2018, 10:38am UTC](https://discuss.bitrise.io/t/git-clone-step-is-very-slow/3844 "2018-01-23T10:38:27Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![aminelaadhari](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/aminelaadhari/32/1132_2.png) [@aminelaadhari](https://discuss.bitrise.io/u/aminelaadhari)\
**Post date:** [January 23, 2018, 10:38am UTC](https://discuss.bitrise.io/t/git-clone-step-is-very-slow/3844/1 "2018-01-23T10:38:27Z")

</div>

# Bitrise Build Issue Report template

## Description of the issue

Git clone step takes more than 3 minutes, in my mahcine it takes only 1min, and 8s in circleci for the same repo.

## Environment:

**Where did the issue happen?**

Xcode 9.2.x

**Which build Step causes the issue and which version of the step?**  
git-clone  
version: 4.0.5

## Reproducibility

- _Does a “Rebuild” help? (You can trigger a rebuild from the Build’s page, by clicking the “Rebuild” button in the top right corner of a finished build)_ : NO
- _Does a rebuild without caches help? (You can remove the `Cache:Pull` and `Cache:Push` steps temporarily to not to use the cache, or [you can delete all the caches on the `Settings` tab of the app](http://devcenter.bitrise.io/caching/about-caching/#downloading-and-deleting-caches)._ : NO
- _Does the issue happen sporadically, or every time?_ : Every time
- _Does upgrading the build Step to the latest version help?_ : NO
- _When did the issue start?_ :

### Local reproduction

No, for my local build it takes 1min

## Build log

> **[Log in - Bitrise](https://app.bitrise.io/users/sign_in)**
>
> Bringing back the joy of iOS & Android development through automating build, testing and support cycles.

---

<div class="post-metadata">

**Author:** ![viktorbenei](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/viktorbenei/32/18_2.png) [@viktorbenei](https://discuss.bitrise.io/u/viktorbenei)\
**Post date:** [January 23, 2018, 4:39pm UTC](https://discuss.bitrise.io/t/git-clone-step-is-very-slow/3844/2 "2018-01-23T16:39:34Z")

</div>

Hi @aminelaadhari,

This is not an issue, just different behaviour.

Why it takes less on Circle CI? Because they cache your source code by default.

By default we don’t store your source code, the source code is only accessed on the build machine, and only in the way you specify it.

If you want us to store your source code you can configure the Build Cache to do so. You can find a related guide at: [How to Cache the Source Code directory](http://discuss.bitrise.io/t/how-to-cache-the-source-code-directory/1533)

Keep in mind that this means:

1. Everything in the source dir will be stored (in the cache), including artifacts / files generated into the source dir.
2. You will store a copy of the source code on our servers.

Another alternative might be to specify a **Clone Depth** for the **Git Clone** step, so that it won’t fetch the whole history every time.

If you have any questions just let us know! 🙂

---

<div class="post-metadata">

**Author:** ![aminelaadhari](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/aminelaadhari/32/1132_2.png) [@aminelaadhari](https://discuss.bitrise.io/u/aminelaadhari)\
**Post date:** [January 23, 2018, 4:52pm UTC](https://discuss.bitrise.io/t/git-clone-step-is-very-slow/3844/3 "2018-01-23T16:52:40Z")

</div>

Hi @viktorbenei, thanks for your response.

Actually, cache pull takes more than 8 minutes to be executed. Is there any guide on how to improve the performance of the cache?

---

<div class="post-metadata">

**Author:** ![viktorbenei](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/viktorbenei/32/18_2.png) [@viktorbenei](https://discuss.bitrise.io/u/viktorbenei)\
**Post date:** [January 23, 2018, 5:00pm UTC](https://discuss.bitrise.io/t/git-clone-step-is-very-slow/3844/4 "2018-01-23T17:00:31Z")

</div>

> [@aminelaadhari](#):
>
> Is there any guide on how to improve the performance of the cache?

Always depends on the setup - I’d suggest you to check the Cache:Push step’s log, it prints what things it caches and how long things take. To optimize the cache you should try to minimize the number of files cached in general.

If you’d need more help feel free to copy paste a related build’s [bitrise.io](http://bitrise.io) URL (where you have the cache setup) and we’ll try to look into it ASAP 🙂

---

<div class="post-metadata">

**Author:** ![aminelaadhari](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/aminelaadhari/32/1132_2.png) [@aminelaadhari](https://discuss.bitrise.io/u/aminelaadhari)\
**Post date:** [January 23, 2018, 5:15pm UTC](https://discuss.bitrise.io/t/git-clone-step-is-very-slow/3844/5 "2018-01-23T17:15:20Z")

</div>

@viktorbenei can you help checking this build? [https://www.bitrise.io/build/4bbfb9186e5c5582](https://www.bitrise.io/build/4bbfb9186e5c5582)  
Thanks

---

<div class="post-metadata">

**Author:** ![viktorbenei](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/viktorbenei/32/18_2.png) [@viktorbenei](https://discuss.bitrise.io/u/viktorbenei)\
**Post date:** [January 24, 2018, 12:28pm UTC](https://discuss.bitrise.io/t/git-clone-step-is-very-slow/3844/6 "2018-01-24T12:28:45Z")

</div>

In the config you linked you have the Cache:Pull step **after** Git Clone. That won’t help with speeding up Git Clone at all, as right now it does a full clean git clone first and only after that it pulls the cache 😉

If all you’d like to cache is the source code then I’d suggest you to have this step sequence:

1. Cache:Pull
2. Git Clone
3. Cache:Push
4. Any other step

---

<div class="post-metadata">

**Author:** ![teameh](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/teameh/32/2684_2.png) [@teameh](https://discuss.bitrise.io/u/teameh)\
**Post date:** [December 13, 2019, 4:21pm UTC](https://discuss.bitrise.io/t/git-clone-step-is-very-slow/3844/7 "2019-12-13T16:21:17Z")

</div>

I’ve tried getting the git repo from the cache before the git clone but that does not work because it seems the his results in this error [https://github.com/bitrise-steplib/steps-git-clone/issues/86](https://github.com/bitrise-steplib/steps-git-clone/issues/86)

I think the .git folder is not included in the cache by default? Would it be possible to set this up? We’re cloning a repo from Europe that takes 10 minutes (vs 30 sec when pulled from github in the US)…

---

<div class="post-metadata">

**Author:** ![ahvth-bitrise](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/ahvth-bitrise/32/2468_2.png) [@ahvth-bitrise](https://discuss.bitrise.io/u/ahvth-bitrise)\
**Post date:** [January 6, 2020, 12:24pm UTC](https://discuss.bitrise.io/t/git-clone-step-is-very-slow/3844/8 "2020-01-06T12:24:20Z")

</div>

Hi @teameh! The repo is not cached by default, though if you manually set up caching for that directory in the step options, I don’t believe we have any special filter in place to ignore the `.git` directory. If you could provide the build URL (`app.bitrise.io/build/<build-slug>`) where you’re experiencing the issue, I’d be happy to look into it.
