1---
2title: Use Git Submodules
3description: Learn how to configure EAS Build to use git submodules.
4---
5
6import { Step } from '~/ui/components/Step';
7
8When using the default Version Control Systems (VCS) workflow, the content of your working directory is uploaded to EAS Build as it is, including the content of Git submodules. However, if you are building on CI or have `cli.requireCommit` set to `true` in **eas.json** or have a submodule in a private repository, you will need to initialize it to avoid uploading empty directories.
9
10## Submodules initialization
11
12To initialize a submodule on EAS Build builder:
13
14<Step label="1">
15
16Create a [secret](/build-reference/variables/#using-secrets-in-environment-variables) with a base64 encoded private SSH key that has permission to access submodule repositories.
17
18</Step>
19
20<Step label="2">
21
22Add an [`eas-build-pre-install` npm hook](/build-reference/npm-hooks/) to check out those submodules, for example:
23
24```bash eas-build-pre-install.sh
25#!/usr/bin/env bash
26
27mkdir -p ~/.ssh
28
29# Real origin URL is lost during the packaging process, so if your
30# submodules are defined using relative urls in .gitmodules then
31# you need to restore it with:
32#
33# git remote set-url origin [email protected]:example/repo.git
34
35# restore private key from env variable and generate public key
36echo "$SSH_KEY_BASE64" | base64 -d > ~/.ssh/id_rsa
37chmod 0600 ~/.ssh/id_rsa
38ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub
39
40# add your git provider to the list of known hosts
41ssh-keyscan github.com >> ~/.ssh/known_hosts
42
43git submodule update --init
44```
45
46</Step>
47