2013-12-17 90 views
0

將我的代碼歷史記錄推送到git存儲庫時,我發現Objective-C項目作爲子模塊工作,這意味着如果我推入Objective-C項目,它將作爲子模塊工作,如this如何刪除git子模塊殘骸?

當我注意到這個因素後,我試着重新初始化我的文件夾.git。 (刪除並試圖調用'git init')

但它根本無法工作,子模塊仍然存在。

我也試過git submodule deinit and init command。但是,之後,即使我試圖將我的文件推送到git存儲庫,它也會拋出此消息。

Sogos-Macbook:Test code dkswogus7530$ git push -u origin master 

To https://github.com/JaehyunAhn/cpuls2_book_review.git 
! [rejected]  master -> master (non-fast-forward) 
error: failed to push some refs to 'https://github.com/JaehyunAhn/cpuls2_book_review.git' 
hint: Updates were rejected because the tip of your current branch is behind 
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull') 
hint: before pushing again. 
hint: See the 'Note about fast-forwards' in 'git push --help' for details. 

我也試圖更新&刪除我的git倉庫鍵入命令的git拉出身主和該命令中止此消息

Compressing objects: 100% (4/4), done. 
Writing objects: 100% (5/5), 537 bytes | 0 bytes/s, done. 
Total 5 (delta 2), reused 0 (delta 0) 
remote: error: object d5c202897cf6f769235a2707d15719636fe37984:contains duplicate file entries 
remote: fatal: Error in object 
error: unpack failed: index-pack abnormal exit 
To https://github.com/JaehyunAhn/cpuls2_book_review.git 
! [remote rejected] master -> master (unpacker error) 
error: failed to push some refs to 'https://github.com/JaehyunAhn/cpuls2_book_review.git' 

我怎樣才能解決這個問題呢?

submodule repository指出從this,thisthis

+0

混帳RM --cached「子模塊目錄」 – johnMa

+0

我試過了也行,不過它刪除了這條消息:Sogos-Macbook:測試代碼dkswogus7530 $ git rm --cached ACM_craft 致命:不刪除'ACM_craft'遞歸地沒有-r – Sogo

回答

1

如果一切都失敗了,你真的只是想重新開始,爲什麼不cd到回購,每個子模塊,然後:

rm -rd .git 
+0

這似乎是第一次工作,但它也拋出了這條消息。 @ Monte + Goulding – Sogo

+0

https://github.com/JaehyunAhn/cpuls2_book_review.git ! [已拒絕]主 - >主(取第一個) 錯誤:未能將某些參考推送到'https://github.com/JaehyunAhn/cpuls2_book_review.git' 提示:更新被拒絕,因爲遠程包含您所做的工作 提示:沒有本地。這通常是由另一個庫推動 提示:對同一參考。在再次推送之前,您可能需要先合併遠程更改(例如, 提示:'git pull')。 提示:有關詳細信息,請參閱'git push --help'中的'關於快速轉發的注意事項'。 Sogos-Macbook:測試代碼dkswogus7530 $ – Sogo

+1

只有當你「真的只是想重新開始」時,我才說過要這樣做。您將無法使用新初始化的倉庫推送到現有的遠程倉庫。再次克隆遠程repo並複製您的更改有什麼問題嗎? –