Mercurial over ssh with configuration file

Let's say I have the following ssh .config file:

Host host_nickname User xxx HostName yyy.zz.vvv ControlMaster auto ControlPath ~/.ssh/% r@ %h:%p 

If you are new to ControlMaster or ControlPath , here is a description from the ssh_config manual :

 ControlMaster: Enables the sharing of multiple sessions over a single network connection. When set to ``yes'', ssh(1) will listen for connec- tions on a control socket specified using the ControlPath argu- ment. Additional sessions can connect to this socket using the same ControlPath with ControlMaster set to ``no'' (the default). These sessions will try to reuse the master instance network connection rather than initiating new ones, but will fall back to connecting normally if the control socket does not exist, or is not listening. 

In Mercurial, if you want to click or pull from the repository, you can simply enter the following:

 hg push ssh:// user@example.com /hg/ 

Now, my question is:

I would like to ask Mercurial to push (or pull) against the repository on /path/to/repository on the server matching my ssh host_nickname configuration entry . How to do it?

+4
source share
1 answer

If you look under hg help urls , you will find

 ssh://[ user@ ]host[:port]/[path][#revision] 

So, assuming /path/to/repository working from your login account on a remote computer, type

 hg [push|pull] ssh://host_nickname/path/to/repository 

This works because hg does not perform name resolution; ssh is, and you specified the correspondence between host_nickname and real HostName . In addition, ControlMaster will not affect this, since it allows only one ssh connection to be multiplexed. Note that if hg not in your remote PATH , you need to specify it via --remotecmd /path/to/hg .

+3
source

All Articles