How can I set default remote repository for mercurial local repository?
Asked
Active
Viewed 4.3k times
113
-
Can you explain? Are you referring to the default URL when you execute `hg pull`? – Matthew Flaschen Sep 27 '10 at 13:16
-
Yes, I get message "repository default not found" after execute "hg pull". – ceth Sep 27 '10 at 13:19
-
1duplicate of [Changing Mercurial “Default” Parent URL](http://stackoverflow.com/questions/860761/changing-mercurial-default-parent-url) ? – David Cary Jul 26 '15 at 14:11
1 Answers
165
It's in the .hg/hgrc file.
[paths]
default = https://myserver/hg/repo1
default:pushurl = /home/me/mytestrepo

Jason Robinson
- 923
- 9
- 11

moswald
- 11,491
- 7
- 52
- 78
-
3
-
34@demas, yes: `echo -e "[paths]\ndefault = http://myserver/hg/repo1\ndefault-push = ../mytestrepo" >> .hg/hgrc` – tonfa Sep 27 '10 at 13:38
-
Yeah, tonfa's right on both counts. You do it by editing a file and if you don't want to pop open an editor you could do it by shell redirect. There's no 'set' command. – Ry4an Brase Sep 27 '10 at 13:56
-
The default-push line makes hg push hanging at "...repository locked by hostname:xxxx" – qed Mar 06 '14 at 14:55
-
That means that a process running on machine *hostname* connected on port *xxxx* has locked your repository. It has nothing to do with the `default-push` line. – moswald Mar 06 '14 at 15:37
-
For anyone new, Mercurial has added a new `--edit` option for the `config` command, which will open your config files in an editor. It's not as simple as `hg config set default=http://myserver/hg/repo1`, but it's a start. – moswald May 05 '14 at 15:04
-
3@demas if you clone it from the original repo, it will set the path correctly--that's the only sane way to do it from the command line. – weberc2 Jan 06 '15 at 07:13
-
-
Just create one with the above contents. There's nothing magical about them. – moswald Jul 21 '16 at 18:10
-
2`man hgrc` says that nowadays (9 years later:-) it should be `default:pushurl` instead of default-push. – Harald May 13 '19 at 12:40