invalid repository name (depth query parameter on a git source)
Fixes Terragrunt git sources failing with 'invalid repository name' when the source URL carries a depth parameter. Use when a git:: source with ?depth=1 fails on Terragrunt 1.1.0-1.1.3. Fixed in 1.1.4; delete the parameter or upgrade.
TL;DR: On Terragrunt 1.1.0-1.1.3, a ?depth=1 on a git:: source breaks the clone: CAS lifts ref out of the URL but leaves depth in, so git sees a repository literally named ...vpc.git?depth=1. Delete the depth parameter (it does nothing on CAS clones) or upgrade to 1.1.4+.
Error: invalid repository name: .../vpc.git?depth=1(git rejecting the URL Terragrunt handed it, with ?depth=1 glued to the repo name)
Steps
Inspect the
source: look for?depth=in the URL, e.g.git::https://github.com/org/vpc.git?depth=1&ref=v5.21.0. Expected: you find the parameter.Delete the
depthparameter:git::https://github.com/org/vpc.git?ref=v5.21.0. Expected: the URL is a clean repo URL plusref.If you need a specific clone depth, set
--cas-clone-depth(default 1, -1 for full history); adepthon the source URL is never applied to a CAS clone. Expected: depth behaves as intended.Or upgrade to Terragrunt 1.1.4+, which strips
depthbefore invoking git. Expected: old sources work unmodified.
When this applies
- Terragrunt 1.1.0-1.1.3, git source with
?depth=(with or withoutref). - The error names your URL with
?depth=attached to.git.
When it doesn't apply
- 1.1.4+:
depthis stripped automatically. - Auth failures on the same URL: that's credentials, not the depth parameter.
Tool versions
Terragrunt v1.1.0-v1.1.3 broken; fixed in v1.1.4.
Why it happens
v1.1.0 made CAS the default path for git sources. CAS parses ref out of the URL to pin the clone, but the depth query parameter wasn't stripped, so the raw URL (still carrying ?depth=1) was handed to git as the repository address.
Edge cases
- A
depthwith NOreffails the same way. - This doesn't look like a version problem (the error names your URL), which is why it survived four releases before the changelog called it out.