diff --git a/content/docs/user-guide/troubleshooting.md b/content/docs/user-guide/troubleshooting.md index fbf5b091b6..897ab9ae13 100644 --- a/content/docs/user-guide/troubleshooting.md +++ b/content/docs/user-guide/troubleshooting.md @@ -125,3 +125,63 @@ and retry the DVC command. Specifically, one of: [internal directories]: https://dvc.org/doc/user-guide/project-structure/internal-files + +## DVC Experiments may fail in Git shallow clones {#git-shallow} + +`dvc exp` commands use internal Git operations which may not work properly in +[shallow clones](https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---depthltdepthgt). +Local Git repositories can be unshallowed with `git fetch --unshallow`. + +This often occurs in transient remote environments such as Continuous +Integration (CI) jobs, which use shallow clones by default. In those cases, +change their configuration to avoid shallow cloning. Common examples: + + + + +[CML](https://cml.dev) has a convenient `--unshallow` option for its +[`ci`](https://cml.dev/doc/ref/ci) command: + +```cli +$ cml ci --unshallow +``` + + + + +Set `fetch-depth` to `0` in the `actions/checkout` action: + +```yaml +- uses: actions/checkout@v3 + with: + fetch-depth: 0 +``` + + + +See the +[GitHub Actions docs](https://github.com/actions/checkout#fetch-all-history-for-all-tags-and-branches) +for more information. + + + + + + +Set the `GIT_DEPTH` env var to `0`: + +```yaml +variables: + GIT_DEPTH: '0' +``` + + + +See the +[GitLab CI/CD docs](https://docs.gitlab.com/ee/ci/large_repositories/#shallow-cloning) +for more information. + + + + +