I had been searching and researching on how to use mercurial through proxy. Even updating Ubuntu is not straightforward if you are lying behind the proxy. If you google it out, you will come across many forums that suggests proper command to be used. But I think there are some restrictions that I discovered today.
(PS: I might be wrong at many places, So please feel absolutely free to correct me. Your opinions/suggestions are most welcome)
Usually, in proxy environment, every user has its own account and it is possible to connect to network only after logging in.
Steps to Follow:
- Edit/create the following files as shown below:
sudo gedit /etc/apt/apt.conf
And add the foll. content
sudo gedit /etc/apt/apt.conf.d/apt.conf
Add the same “Acquire” statements to this file as well.
(PS: I dont know whether editing both the files is required. Expecting an answer from you :P)
2. Let us say, I want to clone mozilla-central,
the usual command:
hg clone https://hg.mozilla.org/mozilla-central
Now, in presence of proxy, the command complicates to something like this:
hg --config http_proxy.host=proxy-site:port-number --config http_proxy.user="username” --config http_proxy.passwd=”password" clone https://hg.mozilla.org/mozilla-central
hg --config http_proxy.host=188.8.131.52:3128 --config http_proxy.user="14219000" --config http_proxy.passwd="amodnn" clone https://hg.mozilla.org/mozilla-central
Few instructions: (when you don’t follow so, you get some AMAZING errors which will force your cognitive senses to believe that it has to do something with Hardware…having no clue that those were just syntactical errors :P)
- In password we cannot include any special characters, esp. ‘@’ and ‘!’ since the ‘Acquire’ command considers it as the end of password. Even enclosing it under the quotes/double quotes won’t work.
say, my password is: amod@123
so, the command will be
and same in the case of ‘clone’ command,
- In “Acquire” cmd, dont forget to terminate the stmnt with semicolon, many ppl forget that.
Performing hg pull and update operations:
- If you are having a dedicated account in your institution then you need to add your user and group to the list of trusted entities.
sudo gedit /etc/mercurial/hgrc
And add the following lines
- Add those lines to .hgrc file as well, preferably update both the files (one at home folder and that in .hg folder
And then you may request pull operation as follows
hg --config http_proxy.host=proxy-site:port-number --config http_proxy.user="username” --config http_proxy.passwd=”password" pull
These were some of my experiences. Please let me know (by comments) if you get to know a better way than mentioned. It would be helpful for me as well to improve.