我正在嘗試將git庫從gilub遷移到Github。我可以添加新的遠程就好了,但是當我試圖推動主到新的遠程,我得到以下錯誤:從git repo中刪除'.git'目錄?
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 '[email protected]:Account/repo.git'
提交a9ee490ac00987835de30bdbc851da5e8d45d28b
中有下列文件:
.git/
CHANGELOG.md
JSONKit.h
JSONKit.m
README.md
很明顯,過去有人使用hg
,在子目錄中檢查完整的git倉庫。
我想只殺死該目錄完全,但我有麻煩去除的提交歷史文件。
在pushing a git repo fails with error: contains '.git'答案沒有幫助,因爲我的回購作爲一個git的回購,而不是一個善變的一個。
我試過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 path 'Account/Libraries/ShareKit/Submodules/JSONKit/.git/config'
error: Invalid path 'Account/Libraries/ShareKit/Submodules/JSONKit/.git/description'
error: Invalid path 'Account/Libraries/ShareKit/Submodules/JSONKit/.git/hooks/applypatch-msg.sample'
error: Invalid path 'Account/Libraries/ShareKit/Submodules/JSONKit/.git/hooks/commit-msg.sample'
error: Invalid path 'Account/Libraries/ShareKit/Submodules/JSONKit/.git/hooks/post-update.sample'
error: Invalid path 'Account/Libraries/ShareKit/Submodules/JSONKit/.git/hooks/pre-applypatch.sample'
error: Invalid path 'Account/Libraries/ShareKit/Submodules/JSONKit/.git/hooks/pre-commit.sample'
error: Invalid path 'Account/Libraries/ShareKit/Submodules/JSONKit/.git/hooks/pre-rebase.sample'
error: Invalid path 'Account/Libraries/ShareKit/Submodules/JSONKit/.git/hooks/prepare-commit-msg.sample'
error: Invalid path 'Account/Libraries/ShareKit/Submodules/JSONKit/.git/hooks/update.sample'
error: Invalid path 'Account/Libraries/ShareKit/Submodules/JSONKit/.git/index'
error: Invalid path 'Account/Libraries/ShareKit/Submodules/JSONKit/.git/info/exclude'
error: Invalid path 'Account/Libraries/ShareKit/Submodules/JSONKit/.git/logs/HEAD'
error: Invalid path 'Account/Libraries/ShareKit/Submodules/JSONKit/.git/logs/refs/heads/master'
error: Invalid path 'Account/Libraries/ShareKit/Submodules/JSONKit/.git/objects/pack/pack-43fac03d375df5c1e380c5e522ba6bcb9b4e1ec1.idx'
error: Invalid path 'Account/Libraries/ShareKit/Submodules/JSONKit/.git/objects/pack/pack-43fac03d375df5c1e380c5e522ba6bcb9b4e1ec1.pack'
error: Invalid path 'Account/Libraries/ShareKit/Submodules/JSONKit/.git/packed-refs'
error: Invalid path 'Account/Libraries/ShareKit/Submodules/JSONKit/.git/refs/heads/master'
error: Invalid path 'Account/Libraries/ShareKit/Submodules/JSONKit/.git/refs/remotes/origin/HEAD'
和歷史似乎並沒有被改變。我處於git知識的極限。誰能幫忙?
是回購開源?你能分享一份嗎? –
啊,沒必要分享有關回購的副本,我已經成功地構建一個Git倉庫用同一種不好的樹,我可以用於測試目的。 –
[推一個git回購失敗,錯誤:包含'.git'](http://stackoverflow.com/questions/14728751/pushing-a-git-repo-fails-with-error-contains-git) –