Using subrepositories with bitbucket

2020-02-09 14:40发布

I have encountered this error when trying to push a subrepository to bitbucket:

D:\Work\agile.crm.framework>hg push
warning: bitbucket.org certificate with fingerprint 81:2b:08:90:dc:d3:71:ee:e0:7
c:b4:75:ce:9b:6c:48:94:56:a1:fe not verified (check hostfingerprints or web.cace
rts config setting)
http authorization required
realm: Bitbucket.org HTTP
user: the_drow
password:
warning: bitbucket.org certificate with fingerprint 81:2b:08:90:dc:d3:71:ee:e0:7
c:b4:75:ce:9b:6c:48:94:56:a1:fe not verified (check hostfingerprints or web.cace
rts config setting)
pushing to https://the_drow@bitbucket.org/the_drow/agile.crm.framework
pushing subrepo Logging to https://the_drow@bitbucket.org/the_drow/agile.crm.fra
mework/Logging
warning: bitbucket.org certificate with fingerprint 81:2b:08:90:dc:d3:71:ee:e0:7
c:b4:75:ce:9b:6c:48:94:56:a1:fe not verified (check hostfingerprints or web.cace
rts config setting)
abort: HTTP Error 404: NOT FOUND

I have encountered this link that describes how to solve the problem but I don't understand what to do.
Should I place my Logging subrepository in D:\Work\?
What exactly should I do with the mercurial subpaths? Will this enable me to clone locally?

EDIT: As requested, here are the contents of my .hgsub file

Logging = Logging

2条回答
2楼-- · 2020-02-09 15:20

As noted in the link that you posted, "You have to make the subrepositories as siblings of the main repository."

So on BitBucket, you need the following structure:

https://bitbucket.org/the_drow/agile.crm.framework
https://bitbucket.org/the_drow/Logging

Then your .hgsub inside agile.crm.framework needs to contain the following:

Logging = ../Logging

查看更多
smile是对你的礼貌
3楼-- · 2020-02-09 15:41

I'm going to bump an old question because I think I have a better solution. I understand why @the_drow has issues with the original accepted answer since with Logging = ../Logging your local machine has to have the Logging subrepo as a peer with the containing/master repo. This kind of defeats the purpose of subrepos from an organization point of view. However, if you use the subpaths feature, you can get Mercurial to rewrite the URI for you on push:

external/my_subrepo = external/my_subrepo

[subpaths]
([https://|ssh://hg@])bitbucket\.org/moswald/my_project/external/my_subrepo = \1bitbucket.org/moswald/my_subrepo

Now my local copy of the my_subrepo sub repository is stored inside my_project as expected, but when I push to Bitbucket, it's rerouted to the real thing. In fact, you can use that rewriting feature to point pretty much anywhere since Mercurial understands Git and SVN. I've got more than a few Bitbucket repositories that have subrepos by other authors who use Github.

查看更多
登录 后发表回答