Question

I am trying to convert an existing git repository to mercurial, but am having no luck. I have already tried hg convert, but when I run hg convert as follows:

hg convert --source-type git --dest-type hg file:///home/localalexa/GitProject/

I get the following error:

file:///home/localalexa/GitProject/ does not look like a Git repository

When I try to clone the repository using hg-git, I get the same error. I have tried using hg convert and hg-git against locally cloned repositories and repositories served over HTTP, and I have tried the conversion/cloning process on Windows and Linux machines. Any help on this is greatly appreciated.

Was it helpful?

Solution

I finally figured out a way to make Mercurial recognize the git repo as a git repo, the steps I took are below (this is assuming you have already set up hg-git on your system):

  1. Install git on your system, and if the repository is remote, clone the repository to your local system.

  2. Serve your local repository using git daemon on your local system, as follows (on Windows you may omit the '&', this just tells Linux to execute the command asynchronously):

    git daemon --base-path=/path/to/repository/parent/ --export-all&

  3. Clone the repository using Mercurial:

    hg clone git://localhost/GitProject

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top