Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using subrepositories with bitbucket

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://[email protected]/the_drow/agile.crm.framework
pushing subrepo Logging to https://[email protected]/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
like image 665
the_drow Avatar asked May 11 '11 16:05

the_drow


People also ask

Does Bitbucket support submodule?

Submodule Changes for Bitbucket helps visualize modified lines of code in commits and pull requests for repositories with submodules. While working with Git submodules, there's a common problem with showing changes that are made to the submodule in the Diff tab.

Can I use Git with Bitbucket?

Git's ability to communicate with remote repositories (in your case, Bitbucket is the remote repository) is the foundation of every Git-based collaboration workflow. Git's collaboration model gives every developer their own copy of the repository, complete with its own local history and branch structure.

How do I add a submodule to a Bitbucket repo?

You simply need to be in your root folder and then add the submodule folder. This option is only valid for the update command. Instead of using the superproject's recorded SHA-1 to update the submodule, use the status of the submodule's remote-tracking branch. This is equivalent to running git pull in each submodule.


2 Answers

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

like image 188
Tim Henigan Avatar answered Nov 15 '22 08:11

Tim Henigan


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.

like image 31
moswald Avatar answered Nov 15 '22 08:11

moswald