How do I clone a repository when I'm behind a proxy?

10,326

Solution 1

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.

Solution 2

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.

Solution 3

You can setup proxy authentication in .hgrc file.

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

[http_proxy]
host=hostname:port
user=username
passwd=password

Note: I currently use SourceTree app on Mac OSX.

Share:
10,326

Related videos on Youtube

DrColossos
Author by

DrColossos

Updated on September 17, 2022

Comments

  • DrColossos
    DrColossos almost 2 years

    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.

  • Brent Bradburn
    Brent Bradburn about 8 years
    May also need export: export http_proxy=...
  • Chris Jones
    Chris Jones over 7 years
    http_proxy also works with https URLs. (Some other programs requires a separate https_proxy environment variable; Hg doesn't.)
  • Dmitry Ilukhin
    Dmitry Ilukhin over 6 years
    It says:hg: --config could not be shortened
  • Adam Houldsworth
    Adam Houldsworth over 6 years
    @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.
  • Dmitry Ilukhin
    Dmitry Ilukhin over 6 years
    Worked in this format (note there is no "=" after "--config"): hg pull -u https://hgserver.com/hg/project --config http_proxy.host=192.168.0.249:8080
  • Mir-Ismaili
    Mir-Ismaili about 5 years
    In Windows machines, the file is ~/mercurial.ini.
  • StayOnTarget
    StayOnTarget almost 5 years
    I confirm the = is not needed - can someone with higher rep make the single-char edit to fix that please?
  • Adam Houldsworth
    Adam Houldsworth almost 5 years
    @DaveInCaz Done :-)
  • StayOnTarget
    StayOnTarget almost 5 years
    @AdamHouldsworth :)