Add a Mercurial Source Code Repository User

Any Mercurial client can clone a project (i.e. create a copy of it on another machine); but only authorized users can push updates to the code on the server.  The programmer that wishes to do so must have a username/password stored on the server.  Here are the steps to add a username (foo) and password (bar) hash to the mercurial repository.

  1. Log onto the server with remote desktop.
  2. Start a command window and change the current directory to the mercurial folder.
  3. Issue this command (for user “foo” with password “bar”):

htpasswd hgusers foo

You will be prompted to enter the password twice:

New password: ********
Re-type new password: ********
Adding password for user foo

When a push is attempted the user is prompted for a username and a password. Here is a screen shot of two push attempts – one before and one after the user is added:

TortoiseHg Sync_Push

Leave a Reply

Your email address will not be published. Required fields are marked *