Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mercurial: remote: abort: There is no Mercurial repository here (.hg not found)!

Tags:

ssh

mercurial

all,

I have searched for this problem for long time and tried different methods.

I want to maintain my code on the server through only SSH. But when I run this:

sudo hg clone -v ssh://carl@hostname//home/carl/Java/Projects/peta/

Mercurial keeps telling me remote: abort: There is no Mercurial repository here (.hg not found)!. Some articles said that the path should be correct and there should be a .hg directory there. But I have checked it for several times and I am sure there is a .hg folder at the right place.

I also tried

hg --config ui.remotecmd=/usr/bin/hg clone ssh://carl@hostname//home/carl/Java/Projects/peta/

But it failed as well. What other problem it could be? Thanks.


Solved

I finally fix the problem. Previously, I create a repository on my local machine, and scp all files (including .hg) on to the server. I try to remove .hg directory first, and create a repo on the server through ssh (hg init). Then hg clone works!

like image 277
Joy Avatar asked Dec 13 '11 17:12

Joy


1 Answers

Extraction from hg help urls

Some notes about using SSH with Mercurial:

  • SSH requires an accessible shell account on the destination machine and a copy of hg in the remote path or specified with as remotecmd.
  • path is relative to the remote user's home directory by default. Use an extra slash at the start of a path to specify an absolute path:

    ssh://example.com//tmp/repository

this means, at least, that you can't use the same URI and change only one/two slash it it: at least one path will be non-existent.

Consequence of the quote and error message: you must to debug (with any ssh-tool) and find correct path to needed directory. you can:

  • use scp (f.e) and copy known file from known location
  • SSH into remote host in interactive session and verify path (both?) by hand, i.e: ssh ..., cd ..., pwd, verify output of pwd
  • ... any other debugger

When you'll get good path after login, you have to check next point of failure - .hg dir permissions

After verification of these checkpoints you'll get clone and some bonus in the form of understanding "What happened before"

HTH

like image 121
Lazy Badger Avatar answered Oct 19 '22 14:10

Lazy Badger