小编dan*_*ana的帖子

从git repo中删除'.git'目录?

我正在尝试将git repo从Kiln迁移到Github.我可以添加新的遥控器,但是当我尝试将master推送到新的遥控器时,我收到以下错误:

Counting objects: 8691, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3000/3000), done.
remote: error: object a9ee490ac00987835de30bdbc851da5e8d45d28b:contains '.git'
remote: fatal: Error in object
error: pack-objects died of signal 13
error: failed to push some refs to 'git@github.com:Account/repo.git'
Run Code Online (Sandbox Code Playgroud)

Commit中a9ee490ac00987835de30bdbc851da5e8d45d28b包含以下文件:

.git/
CHANGELOG.md
JSONKit.h
JSONKit.m
README.md
Run Code Online (Sandbox Code Playgroud)

显然有人在过去使用hg,在子目录中检查完整的git仓库.

我想完全杀死该目录,但是从git历史记录中删除该文件时遇到问题.

推送git repo的答案失败了,错误:包含'.git'没有帮助,因为我将repo作为git repo,而不是mercurial repo.

我试过了git filter-branch --index-filter 'git rm -r --cached --ignore-unmatch .git',但是我得到了错误:

Rewrite 7dbd0970d6c79215d11994b4a9b8091b2e954cfb (326/442)error: Invalid path 'Account/Libraries/ShareKit/Submodules/JSONKit/.git/HEAD'
error: Invalid …
Run Code Online (Sandbox Code Playgroud)

git mercurial git-filter-branch git-rewrite-history

22
推荐指数
2
解决办法
4143
查看次数