How to clone Mercurial repository from remote server?
How do I clone an Mercurial repository if private key is required for SSH?
I tried following and it does not work.
[email protected]:~/foo/test$ hg clone --ssh -i ~/keys/dukeimg ssh://[email protected]/www/bar/
abort: /home/dukeimg/keys/dukeimg: not a Mercurial bundle
Answers:
You're trying to use a ssh
command line (-i
) option with hg
. It’s not supported. Because hg
doesn’t support this option, it looks for the repository to clone at ~/keys/dukeimg
.
There are three possible solutions:
- Use the SSH key agent.
Set Mercurial to use a custom SSH command line (
hgrc
):[ui] ssh = ssh -i ~/keys/dukeimg
Set the SSH client to use a public key for your host (
ssh_config
):Host example.com User my-ssh-user IdentityFile ~/keys/dukeimg
The --ssh
/-e
option is meant to be used like this:
hg -e 'ssh -whatever -option' ...