pushing a git repo fails with error: contains '.git'

前端 未结 2 501
遇见更好的自我
遇见更好的自我 2021-01-20 02:17

I converted a few mercurial repos to git using the hg-fast-export tool and while all of them were converted fine, one produced the following error when I pushed the repo.

2条回答
  •  -上瘾入骨i
    2021-01-20 02:51

    You can use the convert command with a filemap to strip the git repo from the repository. After that it will be gone from the history, and the repository will be safe for importing to git.

    Example:

    $ echo "exclude path/to/.git" > my-filemap
    $ hg convert --filemap my-filemap originalrepo newrepo
    

    Note that convert is a bundled extension which you first need to enable in your .hgrc like so:

    [extensions]
    convert =
    

    For more information see hg help convert.

提交回复
热议问题