> ## Documentation Index
> Fetch the complete documentation index at: https://namespace.so/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Git Checkouts

export const CenteredImage = ({src, alt, width, caption, className}) => {
  const [basePath, setBasePath] = useState("");
  useEffect(() => {
    const path = window.location.pathname;
    setBasePath(path === "/docs" || path.startsWith("/docs/") ? "/docs" : "");
  }, []);
  return <Frame caption={caption} className={className} style={{
    maxWidth: width,
    marginInline: "auto"
  }}>
			<OptimizedImage src={`${basePath}${src}`} alt={alt} />
		</Frame>;
};

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.

<Steps titleSize="h3">
  <Step title="Enable Git checkout caching">
    Open your runner profile in the [Dashboard](https://cloud.namespace.so/workspace/actions/profiles) and enable **Git repository checkouts** in the caching section.

    <CenteredImage width={600} alt="profile cache dialog" src="/docs/images/github-actions/runnerprofilegitcheckouts.webp" />
  </Step>

  <Step title="Configure your workflow">
    To start using the newly enabled cache in your workflow, replace mentions of `actions/checkout` with [`nscloud-checkout-action`](/docs/reference/github-actions/nscloud-checkout-action):

    ```yaml theme={null}
    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](/docs/reference/github-actions/nscloud-checkout-action) for a full
    list of supported options.
  </Step>
</Steps>

If your workflow runs in a container, you also need to mount the git mirror inside the container. See [Running jobs in containers](/docs/solutions/github-actions/runner-controls/containerized-jobs).

## 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 commits 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

* [Cache Volumes overview](/docs/solutions/github-actions/caching)
* [Actions](/docs/solutions/github-actions/caching/actions)

For advanced configuration see [Runner Labels](/docs/reference/github-actions/runner-configuration).
