git checkouts.md
Git Checkouts
Namespace can speed up your git checkouts by caching a mirror of your git repository on a cache volume. Checkout caching works best when cloning large repositories with many files. If you are also checking out submodules or rely on Git LFS, these are automatically cached, too.
1. Enable Git checkout caching
Open your runner profile in the Dashboard and enable Git repository checkouts in the caching section.
2. Configure your workflow
To start using the newly enabled cache in your workflow, replace mentions of actions/checkout with nscloud-checkout-action:
jobs:
tests:
runs-on: namespace-profile-integration-tests
steps:
- name: Check out my repo
uses: actions/checkout@v4 # [!code --]
uses: namespacelabs/nscloud-checkout-action@v8 # [!code ++]
with:
path: my-repo
- run: |
cd my-repo && git status
Check out the action reference for a full list of supported options.
If your workflow runs in a container, you also need to mount the git mirror inside the container. See Running jobs in containers.
Cache isolation per repository
Namespace automatically creates an isolated cache volume for each GitHub repository that uses git checkout caching. The cache volume tag follows the schema github-git-mirror-{owner}-{repository}, so mirrors from different repositories never collide.
Expected use cases
The namespacelabs/nscloud-checkout-action is optimized to speed up only specific use-cases. If your workflows do not belong to these, you might not see the expected performance improvement.
- Very large repositories: when the workflow needs to check out a repository with many or big files.
- Checkout long commit history: when the workflow needs to check out many commits (the default is only 1).
- Repositories with a large set of submodules.
- Repositories with Git LFS objects.
Next steps
For advanced configuration see Runner Labels.