git 使用 bitbucket repo 添加子模块失败

git submodule add failed with bitbucket repo

我正在尝试为我的项目添加一个 repo 作为子模块,因为它将依赖于它。该项目托管在 bitbucket 上,当我尝试使用此添加它时:git submodule add https://bitbucket.org/blueluna/transmissionrpc,我得到以下信息:

Cloning into 'transmissionrpc'...
fatal: repository 'https://bitbucket.org/blueluna/transmissionrpc/' not found
Clone of 'https://bitbucket.org/blueluna/transmissionrpc' into submodule path 'transmissionrpc' failed

我在终端中点击了 link 本身,这导致了一个有效的 link。我不确定如何在我的 github 存储库中添加它。它还会通过 SSH 和 HTTPS 中的 git 克隆给我带来问题。请注意,为克隆此 repo 而复制的原始命令如下:hg clone ssh://hg@bitbucket.org/blueluna/transmissionrpc,据我所知,它使用 mercurial。

因为它是一个 mercurial 回购,错误是预期的:git 无法将其克隆为 (git) 子模块回购。

您需要 git 存储库才能将您的存储库添加为 (git) 子模块。
这将涉及转换,如“Is there a way to use a Mercurial repository as Git submodule?”中所述。

OP cellsheet reports that the conversion part fails with repo.branchtags() unavailable in Mercurial 2.9 , but it can be fixed with the following patch to hg-fast-export.py:

270a271,287

> def legacy_branchtip(repo, heads):
>     '''return the tipmost branch head in heads'''
>     tip = heads[-1]
>     for h in reversed(heads):
>         if not repo[h].closesbranch():
>             tip = h
>             break
>     return tip
> 
> def legacy_branchtags(repo):
>     '''return a dict where branch names map to the tipmost head of
>     the branch, open heads come before closed'''
>     bt = {}
>     for bn, heads in repo.branchmap().iteritems():
>         bt[bn] = legacy_branchtip(repo, heads)
>     return bt
> 
272c289
<   branches=repo.branchtags()
---
>   branches=legacy_branchtags(repo)
> 

块引用