我能从BitBucket上用hg clone命令克隆一个git代码库吗?

9
我正在尝试使用BitBucket git仓库,但我个人更喜欢使用hg。
这个能正常工作:
``` git clone https://myuser@bitbucket.org/projectuser/project.git ```
它会提示我输入密码,然后按预期克隆存储库。
然而,hg不起作用:
``` hg clone https://myuser@bitbucket.org/projectuser/project.git ```
这会导致404错误。
我已经安装了hggit扩展程序。如果我先使用git在本地克隆,然后可以从本地驱动器上将git存储库克隆到一个hg存储库中 - 并且我可以假定我可以从本地hg存储库推回到本地git存储库。
我只想直接从hg拉/推到bitbucket git存储库。有没有方法可以做到这一点?

看起来 hg 和 git 的 URL 不同。例如:git+ssh://git@github.com/schacon/hg-git.git。我不熟悉 hg,但我会更仔细地调查一下 hg 对于 https URL 的期望。 - Thorbjørn Ravn Andersen
1个回答

4

对于访问协议,Mercurial和Git的仓库可以共享(http/s/ + ssh),为了唯一地识别远程端的类型,需要使用特殊类型的协议 - git+real-protocol://

Github上SSH仓库的示例(我手头没有https-URL)

>hg clone git+ssh://git@github.com/lazybadger/Fiver-l10n.git
destination directory: Fiver-l10n
importing git objects into hg
updating to branch default
19 files updated, 0 files merged, 0 files removed, 0 files unresolved

与纯SSH-URL相比

>hg clone ssh://git@github.com/lazybadger/Fiver-l10n.git Fiver-SSH
remote: Invalid command: 'hg -R lazybadger/Fiver-l10n.git serve --stdio'
remote:   You appear to be using ssh to clone a git:// URL.
remote:   Make sure your core.gitProxy config option and the
remote:   GIT_PROXY_COMMAND environment variable are NOT set.
abort: no suitable response from remote hg!

3
谢谢,我需要在前面添加 git+(还要显然从 BitBucket 前面删除 myuser@)。 - Mag Roader

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接