|
| 1 | +# Shallow cloning agents |
| 2 | + |
| 3 | +Agents like Dependabot and GitHub Copilot Coding agent will operate on your repo using a shallow clone. |
| 4 | +Since Nerdbank.GitVersioning dependencies will fail on shallow clones, this can break or at least slow down these agents. |
| 5 | + |
| 6 | +For most repos, setting the `NBGV_GitEngine=Disabled` environment variable is an effective way to unblock these agents. |
| 7 | +This does not completely remove Nerdbank.GitVersioning from your build, but it removes all access to git history and thus allows your builds to succeed in a shallow clone. |
| 8 | + |
| 9 | +A few caveats with this: |
| 10 | + |
| 11 | +* Version stamps will be incorrect. |
| 12 | +* The generated `ThisAssembly` class will still be generated, but with [fewer properties](https://github.com/dotnet/Nerdbank.GitVersioning/issues/1192) (e.g. `GitCommitId`) since that information is not available. |
| 13 | + |
| 14 | +## GitHub Copilot Coding Agent |
| 15 | + |
| 16 | +To configure the Copilot Coding Agent to set this environment variable, follow these steps to set environment variables for the `copilot` environment: |
| 17 | + |
| 18 | +1. Navigate to your GitHub repo's Settings tab. |
| 19 | +1. Select Environments from the list on the left. |
| 20 | +1. Select the `copilot` environment. You may have to create this environment yourself if you have not yet assigned the Copilot Coding Agent an issue to work on in your repo. |
| 21 | +1. Find the "Environment variables" section. |
| 22 | +1. Add an environment variable. Give it the name `NBGV_GitEngine` and the value `Disabled`. |
| 23 | + |
| 24 | +See also [GitHub Copilot Coding Agent docs](https://docs.github.com/en/copilot/how-tos/use-copilot-agents/coding-agent/customize-the-agent-environment#setting-environment-variables-in-copilots-environment) for setting environment variables. |
| 25 | + |
| 26 | +## Dependabot |
| 27 | + |
| 28 | +Dependabot does not yet allow configuring custom environment variables for its runtime environment. |
| 29 | +Consider up-voting [this issue](https://github.com/dependabot/dependabot-core/issues/4660). |
| 30 | +Be sure to vote up the top-level issue description as that tends to be the tally that maintainers pay attention to. |
| 31 | +But you may also upvote [this particular comment](https://github.com/dependabot/dependabot-core/issues/4660#issuecomment-3170935213) that describes our use case. |
0 commit comments