1

I installed hg-git, and I clone my github repository using it:

$ hg clone git+ssh://git@github.com/my/repo.git
$ git status
fatal: This operation must be run in a work tree
$ hg gexport ( now the .git is created )
$ git status
fatal: This operation must be run in a work tree

I can access the repo using Mercurial, I see the history is intact, but I can no longer use git. Ideally, I would like to be able to continue working in git, do commits, and the hg gimport followed by hg push to a mercurial server. However, I can't get the git part running. What can I do?

knittl
  • 246,190
  • 53
  • 318
  • 364
Geo
  • 93,257
  • 117
  • 344
  • 520

1 Answers1

4

hg-git only works from the hg side. why do you create an hg-clone, when you want to work with git?

to be able to push to another hg repository you have to pull git changes into your hg repo, then push. if you want to work with git, you have to create a git clone too (hg should be able to work with both github and your local clone when pulling from them – they have the same object ids)

knittl
  • 246,190
  • 53
  • 318
  • 364
  • Ok,but this means I should have the two repositories in the same folder, the `.hg` and the `.git`. But, I cannot work with git in anyway. In the `.git/config` file I can see that the repo is `bare`. – Geo Aug 14 '11 at 10:21
  • 2
    no, you need two repositories: one git, one hg (in **different** folders). the git repository needs a working tree for you to be able to work with it. I'm not sure, but I think the hg repo can be bare – knittl Aug 14 '11 at 10:22
  • Can I just `gimport` from a git project located somewhere on the disk? – Geo Aug 14 '11 at 10:32
  • 1
    Geo: I have no idea what `gimport` is … but you can clone any [repository on your disk](http://stackoverflow.com/q/5785158/112968) with hg-git (`hg clone /path/to/repo/.git` – if that does not work, start `git-daemon` and clone using the git protocol) – knittl Aug 14 '11 at 10:43