The context of this question is the hg-ssh
script. It is helpful but not critical to know something about Mercurial. This script sets up a forced command using public keys so the given public key setup on the server will only allow the owner of the corresponding private key to push to a permitted set of repositories on the server. This forced commands is usually prefixed to the public key in the file ~/.ssh/authorized_keys
on the server. With regard to this permitted set, the documentation before the script in the link above says:
You can use pattern matching of your normal shell, e.g.:
command="cd repos && hg-ssh user/thomas/* projects/{mercurial,foo}"
The idea is to permit only pushing to repositories on the server that match this pattern. I've been using hg-ssh
with the forced command
command="cd /srv/hg && /usr/local/bin/hg-ssh * */* */*/* */*/*/*",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa [...]
to match all repositories (up to some number of path components) under /srv/hg
, using shell globbing. I belatedly realized that it is not matching paths which contain components starting with .
. My current non-working example is the MQ repository /srv/hg/faheem/bixfile/.hg/patches
. So, my question is,
can I select a pattern that corresponds to all paths? I would prefer to use shell globbing, which are less of a headache than regular expressions in general, but I'd take a regular expression if globbing is not an option.
shopt -s dotglob
before the command would work. – Faheem Mitha Jul 03 '11 at 21:09