0

I want to create a bat file that allow me to run the hg pull command. When i run hg pull, it get some server information and then ask for "user name" and "password". i want to add user name and password automatically. Could you some one please tell me how to solve this.

  • 1
    This might be a duplicate of http://stackoverflow.com/questions/2584407/how-to-save-username-and-password-with-mercurial. – wilx Jan 27 '15 at 10:41
  • possible duplicate of [Mercurial (HG) pull parameters: username and password](http://stackoverflow.com/questions/12185048/mercurial-hg-pull-parameters-username-and-password) – Max Worg Jan 27 '15 at 10:49
  • I want to do this using bat file. i want to give user name and password when hg pull command ask using bat command (cmd command) – Nisala Madhusanka Jan 27 '15 at 11:25

2 Answers2

0

Here's how you can pass credentials to command-line invocation of Mercurial:

hg pull http://.../ --config ui.username={username} --config ui.password={password}

And I recommend using environment variables to store username and password:

hg pull --config ui.username=%HG_USERNAME% --config ui.password=%HG_PASSWORD%
Anton Gogolev
  • 113,561
  • 39
  • 200
  • 288
0

I have found a solution for this. What we have to do is modify the URl as follow with user input

hg pull http://UserName:Password@yourserver.com/hg/yourRepo