Remote stack imports that use the go-getter `//subdir` notation produce a malformed `git clone` URL
- Dominant language
- Go
- Stars
- 1.4k
- Forks
- 175
- Avg merge
- 2d 25m
- Merged PRs (30d)
- 143
Description
### Describe the Bug
## Description
Remote stack imports that use the go-getter `//subdir` notation produce a malformed `git clone` URL in v1.220.0-rc.3 (the first release containing #2037). The subdir portion is dropped, and the repository name is also stripped, so `git` is ultimately invoked against `https://github.com//` — the repo name and subdir path missing.
Both `git::https://...` and `github.com/...` shorthand forms fail the same way. Public and private source repos both reproduce.
## Expected Behavior
Per the [docs](https://atmos.tools/stacks/imports#remote-imports) and the [`examples/remote-stack-imports`](https://github.com/cloudposse/atmos/tree/main/examples/remote-stack-imports) example, the URL below should clone `cloudposse/atmos@main` and merge `examples/quick-start-simple/stacks/orgs/acme/plat/dev.yaml`:
```yaml
import:
- git::https://github.com/cloudposse/atmos.git//examples/quick-start-simple/stacks/orgs/acme/plat/dev?ref=main
```
## Steps to Reproduce (public-repo, self-contained)
`atmos.yaml`:
```yaml
version:
use: "1.220.0-rc.3"
base_path: "."
components:
terraform:
base_path: components/terraform
stacks:
base_path: stacks
included_paths: ["**/*"]
name_pattern: "{environment}-{stage}"
```
`stacks/dev.yaml`:
```yaml
import:
- git::https://github.com/cloudposse/atmos.git//examples/quick-start-simple/stacks/orgs/acme/plat/dev?ref=main
vars:
namespace: acme
tenant: plat
environment: ue1
stage: services-dev-01
```
Run: `atmos describe stacks -s ue1-services-dev-01`
## Actual Behavior
```
Error: failed to download remote import
'git::https://github.com/cloudposse/atmos.git//examples/quick-start-simple/stacks/orgs/acme/plat/dev?ref=main'
in file 'dev.yaml': failed to download remote import: failed to fetch content
for cache: failed to download file: /usr/bin/git exited with 128: Cloning into
'/.../getter.../temp'...
remote: Not Found
fatal: repository 'https://github.com/cloudposse/' not found
```
Note the URL git received: `https://github.com/cloudposse/` — both the repo name (`atmos.git`) and the `//examples/...` subdir are missing.
Debug-log excerpt from a token-injected (private-repo) variant — note the subdir is already absent from the very first detector.
The subdir portion (`//stacks/mixins/region/us-east-1`) present at `Download` time is gone by the time CustomGitDetector logs its input — suggesting the source URL is correctly separated from the subdir, but the subdir is then dropped, never re-appended, **and** the final clone command is further mangled to omit the repo name itself.
## Environment
- atmos: v1.220.0-rc.3 (asdf-managed install on darwin/arm64; also reproduces in Linux GHA runner)
- macOS 25.5.0
- Reproduces with both public (`cloudposse/atmos`) and private source repos
- Reproduces with `git::https://` explicit form **and** `github.com/...` shorthand
- HTTPS file URL form (`https://raw.githubusercontent.com/owner/repo/branch/file.yaml`) works for public files (no auth path for private repos)
## Additional Context
- First release containing #2037 / closing #2036; new `pkg/stack/imports/` package and `pkg/downloader/custom_git_detector.go` are in this code path.
- Happy to test a candidate patch against the same scenario.
### Expected Behavior
_No response_
### Steps to Reproduce
_No response_
### Screenshots
_No response_
### Environment
_No response_
### Additional Context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.