To store passwords permanently for Mercurial repositories you have two options. One possibility is to store it as clear text in your Mercurial configuration file in ~/.hgrc. Of course you should never do that and that’s why I won’t explain how this could be done. Instead you should use a Mercurial extension which allows you to store passwords in a keyring. This blog post summarizes how this can be done.
At first download this file and save it somewhere, e.g. ~/.hg/mercurial_keyring.py. As a next step open ~/.hgrc (create the file if it doesn’t already exist) and add the following lines.
Make sure to change the path to the actual location of the file which you just downloaded. Now you just have to install the following dependencies and you are done.
Next time you push / pull something you should be asked for the last time for your password. If you run into any troubles you should consult this wiki page.