Description
Does replace example.com/foo/bar vX.Y.Z => private.example.com/foo/bar.git vX.Y.Z not work?
As far as I can tell it does not work with
github.com
and other "commonly-used VCS hosting sites" (refer tonoVSCSuffix
in cmd/go/internal/vcs/vcs.go). Go 1.15 gives you "invalid version control suffix in github.com/ path".@bcmills, if a user could do
replace ( github.com/foo/bar <version> => github.com/foo/bar.git <version> )
forcing the use of
git
instead ofhttps
, that could solve it.How about if you want the opposite behavior? That is, you specified replace .. .git BUT wanted to use HTTPS protocol instead of SSH? Non-github hosting sites like (private) gitlab.com enforces .git extension, but there are cases where developer needs to work on pre-existing code set(e.g. - migrated code to gitlab!) and wanted to retain to use HTTPS but importing in the new gitlab repository, which has .git extension in the url.
Example, this replace will force "go get" or "go mod tidy" to use ssh protocol on fetch, but is there a way to say use HTTPs?
replace ( github.com/foo/bar <version> => gitlab.com/foo/bar.git <version> )
Originally posted by @grecinto in #39536
There are cases one wants to use HTTPs even if module URL ends w/ .git. Example, migration of code from GitHub to private GitLab repos. Being able to continue using HTTPs protocol on "go get" or "go mod tidy" (module fetch) will give flexibility to continue using the current code and change it to use git(ssh protocol) at a later point in time, or not at all.