2015-09-15 49 views
0

我有一個項目有幾個(10+)子模塊,然後在所有其他子模塊的家中創建另一個[裸]存儲庫,並使用git submodule add將它添加到我的項目。Git Submodule Hell on添加:「致命:遠程<url>已存在

不幸的是,當我檢查出的主,它增加了從目錄中的文件,而不是將其識別爲一個子模塊。

在這個例子中,我們假設它會被安裝/放置在components/NewComponent和它的網址是customURL://components/NewComponent.git(注意:customURL://正確配置在〜/ .gitconfig中,正在被其他10+子模塊完美)

因爲我已經做了git rm components/NewComponent ; git commit -m "Removed the offending directory"

然而,當我打電話:

git remote add customURL://components/NewComponent.git components/NewComponent 

我得到這個錯誤:

fatal: remote customURL://components/NewComponent.git already exists. 

但它不是在成分目錄,也沒有在.gitmodules文件。

如果我手動把它的文件,如果我這樣做也沒關係deinitinitupdatesync,甚至完全克隆庫,並重新init並重新update它,有一件事是完全忽略。 git submodule status不會顯示它的狀態(雖然它顯示了其他所有內容!)或任何東西。它完全忽略了它的存在。

任何幫助將不勝感激!

注:

  • 當前Git版本:git version 1.8.3.4 (Apple Git-47)

UPDATE:

這是一個PEBKAC問題....我應該寫git submodule add

回答

1

查看手冊頁git remote。遠程的名字應該在add旁邊。

+0

有趣。我最初在OS X El Capitan上創建了它們,它是git版本(「git version 2.3.8(Apple Git-58)」)希望'git submodule add [--name ] []',指出我希望'git submodule add '並沒有列出一種方法將它放在相對路徑上。 – iAdjunct

+0

但是,當我手動將它放入'.gitmodules'文件時,它仍然忽略此子模塊。 – iAdjunct

+0

哦。當我寫上述內容時,我寫了一個錯誤的名詞......現在編輯了......我覺得很愚蠢。 –