dpqmu84646 2017-03-30 16:38
浏览 181
已采纳

由于url中的.git,无法从私有git存储库获取数据

When using github.com, the url used to browse to a repo does not contain the .git extension:

but the "clone with https" url does:

And you go get it like this:

go get github.com/someuser/helloworld

In our private git repo, we create bare repos in a directory ending in .git (based on convention):

  • helloworld.git

But the url (served using https://github.com/klaussilveira/gitlist) to browse to the repo also contains .git:

This causes go get to fail because it doesn't expect the .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

Leaving off the .git part also fails:

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 ())

Renaming the bare repo to just helloworld solves the problem. But this isn't the convention.

What am I missing? Is there a server setting we are missing so that we can leave off the .git extension when browsing? Should we just just leave off .git when naming the bare repo? Why does github.com have different behavior?

  • 写回答

1条回答 默认 最新

  • dongxin1980 2017-03-30 16:56
    关注

    On the repo server, use a soft link along side each of the repos. So in this case, just do a

    ln -s helloworld.git helloworld
    

    and it should work based on the fact that the rename worked.

    Um, if it's a Windows server... I'm sure you can google a way to create a soft link, sometimes called a symlink.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 mmocr的训练错误,结果全为0
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀