Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: go get git.mycompany.com/foo/bar creates a foo/bar.git directory instead of foo/bar #9773

Closed
dmitris opened this issue Feb 4, 2015 · 3 comments

Comments

@dmitris
Copy link
Contributor

dmitris commented Feb 4, 2015

We have a git server that only supports SSH authentication. I use a .gitconfig setting with the insteadOf mapping:

[url "git@git.mycompany.com:"]
insteadOf = https://git.mycompany.com/

$ go get -d -v git.mycompany.com/dmitris/webseclab.git
# cd .; git ls-remote git://git.mycompany.com/dmitris/webseclab
fatal: remote error:
  GitHub private mode is enabled. Git protocol is disabled. Use authenticated http or ssh access instead.
git.mycompany.com/dmitris/webseclab.git (download)
$ ls $GOPATH/src/git.mycompany.com/dmitris
webseclab.git

I would expect the directory webseclab and webseclab.git to be created. With the directory ending with ".git", you cannot go to the next step - go install -v git.mycompany.com/dmitris/webseclab
but instead have to rename the directory first.

@minux
Copy link
Member

minux commented Feb 4, 2015 via email

@mikioh mikioh changed the title cmd/go - go get git.mycompany.com/foo/bar creates a foo/bar.git directory instead of foo/bar cmd/go: go get git.mycompany.com/foo/bar creates a foo/bar.git directory instead of foo/bar Feb 5, 2015
@dmitris
Copy link
Contributor Author

dmitris commented Feb 5, 2015

.git suffix in "go get -d -v git.mycompany.com/dmitris/webseclab.git" is necessary to signal to "go get" that it should treat the repository as a Git one. But the created directory should be webseclab, not webseclab.git. Compare the git command-line invocation:

git clone git@github.com:yahoo/webseclab.git

it produces a webseclab directory as you expect, not webseclab.git one.

If go get creates a directory ending with .git as now, you cannot follow go install -d <git_server>/<package_name> with go install -v <package_name>/... - but instead have to first do mv <package_name>.git <package_name> which is annoying and unnecessary.

Does it make sense?

I'm going to ask on golang-dev@ if the Go team would consider adding -scm command-line option so that you could do go get -d -scm=git git.mycompany.com/dmitris/webseclab and it would work just like with the hardwired github.com without having to add ".git" suffix.

@adg
Copy link
Contributor

adg commented Feb 5, 2015

If you don't want ".git" in the path, then use a meta tag to specify a custom import path.

It's documented here: http://golang.org/cmd/go/#hdr-Remote_import_paths

The Go command is otherwise working as intended.

@adg adg closed this as completed Feb 5, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants