There's an option http_proxy which should allow access through proxy, but it's not clear whether this should be in the command line, .hgrc or some global variable.

I tried it in the command line:

hg --config=http_proxy.host=_proxy server_

but I still get a Connection timed out error.

3 Answers 3


It's actually an environment variable, so try

http_proxy=http://proxy_server:4242 hg ...

You should replace 4242 with whatever port your proxy is running on.

  • May also need export: export http_proxy=... May 2, 2016 at 18:35
  • http_proxy also works with https URLs. (Some other programs requires a separate https_proxy environment variable; Hg doesn't.) Mar 10, 2017 at 15:33

I can successfully use the following command:

hg clone <TheURl> <Optional Folder Name> --config http_proxy.host=<proxy URL>

And obviously by replacing any <> instances with the relevant details.

  • It says:hg: --config could not be shortened Dec 7, 2017 at 11:29
  • @DmitryIlukhin I guess a lot can happen in 3 years, don't use Mercurial anymore so I'm not sure if the command has changed. Dec 7, 2017 at 12:35
  • Worked in this format (note there is no "=" after "--config"): hg pull -u https://hgserver.com/hg/project --config http_proxy.host= Dec 21, 2017 at 13:05
  • I confirm the = is not needed - can someone with higher rep make the single-char edit to fix that please? Jul 17, 2019 at 17:07
  • @DaveInCaz Done :-) Jul 19, 2019 at 10:14

You can setup proxy authentication in .hgrc file.

It store in ~/.hgrc. Here is an example.


Note: I currently use SourceTree app on Mac OSX.

  • In Windows machines, the file is ~/mercurial.ini. Jun 13, 2019 at 3:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .