推一个git回购失败,错误:包含'.git' [英] pushing a git repo fails with error: contains '.git'

查看:95
本文介绍了推一个git回购失败,错误:包含'.git'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用hg-fast-export工具将一些mercurial回购转换为git,虽然它们都转换得很好,但当我推送回购时,产生了以下错误。

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.

$ git remote add origin git@github.com:asdf/zxcv.git
$ git push -u origin master
Counting objects: 7840, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2817/2817), done.
error: object 324f9ca2aaae7b1d716db3fc31c02d391c1c2c16:contains '.git'
fatal: Error in object
error: pack-objects died of signal 13
error: failed to push some refs to 'git@github.com:asdf/zxcv.git'

包含'.git'错误非常广义的条款,并且找不到任何文档,所以我试图在原始回购库中搜索现有的'.git'文件夹,我也这样做了。有一个sububsub文件夹,其中包含一个旧的git存储库的实例,我用git rm删除了这个问题,但问题仍然存在。

"contains '.git'" error has very broad terms and couldn't find any documentation so I tried to search for an existing '.git' folder in the original repo and I did. There was a subsubsub-folder that contains an instance of an old git repository which I removed with git rm, however, the problem remained.

有什么方法可以推送到github或新的清洁回购是唯一的选择?

Is there anyway I can push this to github or a new clean repo is the only option?

在此赞赏任何帮助。
Thanks!

Any help in this appreciated. Thanks!

推荐答案

您可以使用 convert 命令使用 filemap 从仓库中去除git仓库。之后,它将从历史中消失,并且存储库对于导入到git是安全的。

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

请注意 convert 是一个捆绑扩展,您首先需要在 .hgrc 中启用这样的扩展:

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

[extensions]
convert =

欲了解更多信息,请参阅 hg help convert

For more information see hg help convert.

这篇关于推一个git回购失败,错误:包含'.git'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆