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.


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=... – nobar May 2 '16 at 18:35
  • http_proxy also works with https URLs. (Some other programs requires a separate https_proxy environment variable; Hg doesn't.) – Chris Jones Mar 10 '17 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 – Dmitry Ilukhin Dec 7 '17 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. – Adam Houldsworth Dec 7 '17 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= – Dmitry Ilukhin Dec 21 '17 at 13:05
  • I confirm the = is not needed - can someone with higher rep make the single-char edit to fix that please? – StayOnTarget Jul 17 '19 at 17:07
  • @DaveInCaz Done :-) – Adam Houldsworth Jul 19 '19 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. – Mir-Ismaili Jun 13 '19 at 3:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.