hashicorp / go-getter

Package for downloading things from a string URL using a variety of protocols.
Mozilla Public License 2.0
1.66k stars 239 forks source link

Unable to download group gitlab repository files #479

Open denis256 opened 7 months ago

denis256 commented 7 months ago

Noticed that go-getter fail to download files from gitlab repositories which are located in subgroups:

(go-getter_1.7.3_linux_amd64)

$ go-getter "github.com/denis256/s3.git//module2" /tmp/qwe
2024/04/01 18:01:56 success!

$ go-getter "gitlab.com/denis256/s3.git//module2" /tmp/qwe
2024/04/01 18:10:40 success!

$ go-getter "gitlab.com/denis25-tests/dc/platform/terraform-modules/s3.git//module2" /tmp/qwe
2024/04/01 18:02:19 Error downloading: error downloading 'https://gitlab.com/denis25-tests/dc.git': /usr/bin/git exited with 128: Cloning into '/tmp/getter72444115/temp'...
remote: The project you were looking for could not be found or you don't have permission to view it.
fatal: repository 'https://gitlab.com/denis25-tests/dc.git/' not found

References: https://github.com/denis256/s3 https://gitlab.com/denis256/s3 https://gitlab.com/denis25-tests/dc/platform/terraform-modules/s3

gmaghera commented 7 months ago

The issue stems from around here: https://github.com/hashicorp/go-getter/blob/975961f5f06346ccc282cd0d9aa16e160d26f9e3/detect_gitlab.go#L42-L44

And there is a clear indication of the (incorrect) assumption that all gitlab.com projects are personal projects here: https://github.com/hashicorp/go-getter/blob/975961f5f06346ccc282cd0d9aa16e160d26f9e3/detect_gitlab.go#L27-L30

gmaghera commented 7 months ago

Here is the related documentation https://docs.gitlab.com/ee/user/group/subgroups/

Subgroups can be "Be nested up to 20 levels."

gmaghera commented 5 months ago

Could you associate PR https://github.com/hashicorp/go-getter/pull/494 with this issue?

gmaghera commented 3 months ago

bump