Easily build public Bitbucket/Mercurial repo with ssh subrepos
I'm building a public repo which has two public subrepos, referenced via ssh URLs. All of them are on BitBucket/Mercurial. By default, AppVeyor uses https to clone the main repo, and fails when it gets to the submodules:
hg clone -r ... https://bitbucket.org/... C:\projects\..
...
[successful clone of the main repo]
...
remote: Permission denied (publickey).
abort: no suitable response from remote hg!
Command exited with code 255
Is it supposed to use https? Your documentation says this: "When you add a project in AppVeyor a new RSA key-pair is generated which consists of private and public keys. Public key is deployed to a remote Git repository using GitHub (or BitBucket) API and private key is pushed to build worker during the build."
Now, admittedly it also says that this is what happens for _private_ repos. All of the repos involved in my case are public repos, so presumably you're thinking there's no need to mess around with SSH keys in this case, correct?
Assuming I got this right, I can see two ways to solve this. #1 is to push a key created by AppVeyor even for public repos (maybe only if a checkbox is checked?). #2 is to rewrite the .hgsub file to change ssh URLs into https URLs. I wouldn't want to commit these updated submodule URLs for obvious reasons, but as a work-around for the build it sounds quite reasonable.
I'm going to try approach #2 using a pre-build script, but it would be neat if AppVeyor had built-in support for this scenario.
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
| ? | Show this help |
|---|---|
| ESC | Blurs the current field |
Comment Form
| r | Focus the comment reply box |
|---|---|
| ^ + ↩ | Submit the comment |
You can use Command ⌘ instead of Control ^ on Mac

Support Staff 1 Posted by Feodor Fitsner on 26 Mar, 2016 07:50 PM
There is another approach (for git, but it's still applicable to Mercurial): http://www.appveyor.com/docs/how-to/private-git-sub-modules
I'd go for #2 and create a simple PowerShell script modifying .hgsub before fetching sub-modules.
2 Posted by RS on 28 Mar, 2016 07:14 PM
So, modifying .hgsub in a way that doesn't upset Mercurial is not particularly easy, but I've found a more appropriate feature for this: [subpaths]. Here's a clone script that worked for me. Posting in case anyone else needs to do the same thing:
Support Staff 3 Posted by Feodor Fitsner on 28 Mar, 2016 07:20 PM
Nice, thanks for sharing the solution!
Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 02:05 AM.