mercurialsshpasswordshgrc

How to config mercurial to push without asking my password through ssh?


I use mercurial in my project, and every time I push new changesets to the server by ssh, it ask me for a password.
Then how to config the mercurial to push with out asking password?

I works on Ubuntu 9.10


Solution

  • On Linux and Mac, use ssh-agent.

    1. Ensure you have an ssh keypair (see man ssh-keygen for details)
    2. Copy your public key (from ~/.ssh/id_dsa.pub) to the remote machine, giving it a unique name (such as myhost_key.pub)
    3. Log in to the remote machine normally and append the public key you just copied to the ~/.ssh/authorized_keys file
    4. Run ssh-add on your local workstation to add your key to the keychain

    You can now use any remote hg commands in this session without requiring authentication.