Connect to BitBucket through a proxy server

Hoi,

I'm trying hg pull
from my private repo at Bitbucket.org
in my local repo on my windows machine
Due to the proxy server of the company that requires Windows authentication.

  • I found a proxy server and port (IE Internet options)
  • I found Mercurial.ini settings in my %USERPROFILE%
  • I added this section to it ( info ):

    [http_proxy]
    host = TheProxyServer : TheProxyServerPort
    user = MyWindowsLogin
    passwd = MyWindowsPassword

  • It works:

C: \ path \ to \ repo> hg pull
Authorization Required http realm: Bitbucket.org HTTP
user:

after entering the Bitbucket credentials, I get:

search for changes
no changes found

But writing a password in Mercurial.ini is obviously a serious security issue (besides having to update this file every month because of our password policies).

Is it possible to let Mercurial request proxy credentials?
Or save these credentials in a more secure way?

Edit:

I tried with the same settings and SSH, but I got this:

C: \ path \ to \ repo> hg clone ssh: //hg@bitbucket.org/ME/repo/
"C: \ Program Files \ TortoiseHg \ TortoisePlink.exe" -ssh -2 hg@bitbucket.org "hg -R ME / repo / serve -stdio"

abort: no suitable answer from remote hg!

And the dialog: "PuTTY Fatal Error - Network error: Connection timed out"

Edit2:

This question arose because Subversion handled this situation correctly:

In the Subversion servers file, I also specify the proxy host and port, and Subversion automatically sends me its Windows authentication. I do not need to enter and record my credentials anywhere when you check the source from the Internet through a proxy server, for example,

C: \ workingdir> svn checkout http://okarito.googlecode.com/svn/trunk/ okarito-read-only
... Issued revision 5.

Thanks in advance! Yang

+7
bitbucket svn mercurial proxy
source share
2 answers

Another alternative is to run a local HTTP proxy, which is then authenticated with your company’s http proxies. You can run cntlm under Cygwin and safely store the NTLMv2 hash file in the cmlm conf file. Then you set localhost: 3128 for the http proxy and do not specify a username or password.

My other suggestion is to use TortoiseHg. This will save your proxy information, but I'm not sure if it is safely stored.

+5
source share

You can use the --config option for hg , as this allows you to override configuration options from the command line. The syntax is --config <section>.<name>=<value> , so try the following:

 hg --config http_proxy.passwd=YourWindowsPassword pull 

This will leave your password in the command history, but it is probably better than in the Mercurial.ini file.

+3
source share

All Articles