12

I have a Mercurial repository on a remote VPS. The VPS has SSH access enabled. What are my options for pushing code changes from my development machine to the remote VPS?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
richzilla
  • 40,440
  • 14
  • 56
  • 86

1 Answers1

26

If your VPS has Mercurial installed, simply:

hg push ssh://username@host/path/relative/to/home

or add to the repo's hgrc

[paths]
default-push = ssh://username@host/path/relative/to/home

and just

hg push
mpm
  • 1,935
  • 11
  • 13
Lazy Badger
  • 94,711
  • 9
  • 78
  • 110
  • 2
    FYI for anyone else that comes here, before attempting the above: When doing hg push, you need a double slash after hostname, for an absolute path. See [this answer.](http://stackoverflow.com/questions/4431884/cloning-a-mercurial-repository-over-ssh#answer-8096666) – deadbeef404 Jun 20 '14 at 04:57
  • 1
    No, it's not needed, it just means something else. A double slash makes the path absolute on the host, a single slash is relative to home (as correctly mentioned in Lazy Badger's answer). – RedGlyph Jun 29 '14 at 16:17
  • @RedGlyph, you are correct. I've updated my post to be slightly clearer about my meaning. – deadbeef404 Jul 02 '14 at 04:24
  • but what if i want to push to `/run/media/$DEVICE_LABEL`, not in home dir of user ? – alexzander Aug 09 '21 at 10:44
  • @alexzander Then you would use the double slash after the hostname as mentioned by deadbeef404. – Clonkex Mar 06 '22 at 22:27