【发布时间】:2017-03-30 16:38:02
【问题描述】:
使用 github.com 时,用于浏览 repo 的 url 不包含 .git 扩展名:
但“使用 https 克隆”网址可以:
然后你就这样得到它:
go get github.com/someuser/helloworld
在我们的私有 git 仓库中,我们在以 .git 结尾的目录中创建裸仓库(根据约定):
- helloworld.git
但是浏览到 repo 的 url(使用 https://github.com/klaussilveira/gitlist 提供)也包含 .git:
这会导致 go get 失败,因为它不期望 .git:
C:\>go get -u -f -insecure git.test.net/helloworld.git
# cd .; git clone git.test.net/helloworld C:\Temp\golang\src\git.test.net\helloworld.git
fatal: repository 'git.test.net/helloworld' does not exist
package git.test.net/helloworld.git: exit status 128
离开 .git 部分也会失败:
C:\>go get -u -f -insecure git.test.net/helloworld
package git.test.net/helloworld: unrecognized import path "git.test.net/helloworld" (parse https://git.test.net/helloworld?go-get=1: no go-impor
t meta tags ())
将裸仓库重命名为 helloworld 即可解决问题。但这不是惯例。
我错过了什么?我们是否缺少服务器设置,以便我们在浏览时可以省略 .git 扩展名?在命名裸仓库时,我们是否应该省略 .git?为什么 github.com 有不同的行为?
【问题讨论】: