Using Hg Mercurial behind a proxy

Published by: 0

You might have faced to download gigabytes of repositories with Hg. In my case, a big portion of Mozilla repositories depends on it and wanted to download that huge repos from the university network. University bandwidths are mostly underused 😉

Hg uses hgrc file to load configurations. (Per repository) You can go to your repository, .hg/hgrc and add following with your configurations.

[http_proxy]
host = your.proxy.host:8000
passwd = password
user = username

In case you are using hg from a preloaded instance to clone repositories to another location, you can simply add your configurations as a prefix to your command.

[code]hg –config http_proxy.host=[proxy_ip]:[proxy_port] –config http_proxy.user=[username] –config http_proxy.passwd=[password] push[/code]

Make sure if you have special characters(@,%,\,.) in your username or password you use the suitable character representation for it. ie : use %40 instead of @ symbol. This will also help in finding special character representation.

Cheers!