# How to parallelize git submodules

**URL:** https://discourse.cmake.org/t/how-to-parallelize-git-submodules/10056
**Category:** Usage
**Created:** [February 11, 2024, 7:01pm UTC](https://discourse.cmake.org/t/how-to-parallelize-git-submodules/10056 "2024-02-11T19:01:16Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![bmagistro](https://discourse.cmake.org/user_avatar/discourse.cmake.org/bmagistro/32/2856_2.png) [@bmagistro](https://discourse.cmake.org/u/bmagistro)
#### Post date: [February 11, 2024, 7:01pm UTC](https://discourse.cmake.org/t/how-to-parallelize-git-submodules/10056/1 "2024-02-11T19:01:16Z")

</div>

We are trying to build boost using cmake (this works and is not the issue). The challenge is the time it takes to clone the submodules. It appears git supports fetchJobs which can allow this to be parallelized. By default it looks to only run 1 job at a time. How can one either set/ensure the git config with this parameter is used or pass `--jobs` to the git command used in `FetchContent`

---

<div class="post-metadata">

### Author: ![scivision](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/s/a87d85/32.png) [@scivision](https://discourse.cmake.org/u/scivision)
#### Post date: [February 11, 2024, 10:09pm UTC](https://discourse.cmake.org/t/how-to-parallelize-git-submodules/10056/2 "2024-02-11T22:09:20Z")

</div>

NOTE: this comment does not generally apply for Git submodules.

The `git clone --jobs` would be the likely option to help Git clone with Git submodules.

* * *

In general, for ExternalProject or FetchContent with a huge Git repo I use the project’s source archive URL if available. [Benchmark of URL vs. GIT\_REPOSITORY](https://gist.github.com/scivision/c7377450e3038c3808138189c57a0478) shows more than 10x speedup possible with URL archive.

---

<div class="post-metadata">

### Author: ![bmagistro](https://discourse.cmake.org/user_avatar/discourse.cmake.org/bmagistro/32/2856_2.png) [@bmagistro](https://discourse.cmake.org/u/bmagistro)
#### Post date: [February 12, 2024, 10:26am UTC](https://discourse.cmake.org/t/how-to-parallelize-git-submodules/10056/3 "2024-02-12T10:26:37Z")

</div>

While I appreciate the suggestion, it does not address the question. Additionally, and I would have to check again but boost did/does not provide a compatible release archive so that method may not be a viable option here.

---

<div class="post-metadata">

### Author: ![scivision](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/s/a87d85/32.png) [@scivision](https://discourse.cmake.org/u/scivision)
#### Post date: [February 12, 2024, 4:32pm UTC](https://discourse.cmake.org/t/how-to-parallelize-git-submodules/10056/4 "2024-02-12T16:32:02Z")

</div>

At first glance since Git config can set [fetchParallel](https://git-scm.com/docs/git-config#Documentation/git-config.txt-fetchparallel)

Git submodule in parallel might be something the [ExternalProject GIT\_CONFIG](https://cmake.org/cmake/help/latest/module/ExternalProject.html#git) could do.

Is this the top-level repo you’re using for Boost?

`https://github.com/boostorg/boost`

---

<div class="post-metadata">

### Author: ![bmagistro](https://discourse.cmake.org/user_avatar/discourse.cmake.org/bmagistro/32/2856_2.png) [@bmagistro](https://discourse.cmake.org/u/bmagistro)
#### Post date: [February 13, 2024, 6:10pm UTC](https://discourse.cmake.org/t/how-to-parallelize-git-submodules/10056/5 "2024-02-13T18:10:49Z")

</div>

That works thank you. I knew there had to be a config parameter but could not seem to find it when looking (probably scrolled past it a dozen times)

---

<div class="post-metadata">

### Author: ![scivision](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/s/a87d85/32.png) [@scivision](https://discourse.cmake.org/u/scivision)
#### Post date: [February 13, 2024, 10:29pm UTC](https://discourse.cmake.org/t/how-to-parallelize-git-submodules/10056/6 "2024-02-13T22:29:11Z")

</div>

Great! What GIT\_CONFIG worked for you? I can add it to ExternalProject CMake docs

---

<div class="post-metadata">

### Author: ![bmagistro](https://discourse.cmake.org/user_avatar/discourse.cmake.org/bmagistro/32/2856_2.png) [@bmagistro](https://discourse.cmake.org/u/bmagistro)
#### Post date: [November 11, 2025, 12:28am UTC](https://discourse.cmake.org/t/how-to-parallelize-git-submodules/10056/7 "2025-11-11T00:28:41Z")

</div>

Sorry for the very late reply, cleaning up old emails and noticed I never replied. We are on boost 1.88.0 right not but believe this was working as far back as 1.80.0. Shallow on this is a huge time saver for obvious reasons.

```auto
FetchContent_Declare (
   Boost
   GIT_REPOSITORY <internal mirror of github>
   GIT_TAG boost-1.88.0
   GIT_SHALLOW true
   GIT_CONFIG "submodue.fetchJobs=12"
)
```
