我在我的网站上使用 gitflow,但是我使用 Git 下载了第 3 方库,但无法将其添加到我的主存储库中。如果我尝试这样做,我会收到以下消息:
致命:路径“FILENAME”位于子模块“SUBMODULE_NAME”中
如果我运行 cat .git/config
我得到:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[gitflow "branch"]
master = master
develop = develop
[gitflow "prefix"]
feature = feature/
release = release/
hotfix = hotfix/
support = support/
versiontag =
[remote "origin"]
url = <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d8bfb1ac98bfb1acb0adbaf6a0a0a0a0" rel="noreferrer noopener nofollow">[email protected]</a>/xxxx.git
fetch = +refs/heads/*:refs/remotes/origin/*`
如果我找到 . -名称“.git*”
./libs/3RD_PARTY_NAME/.git
./libs/3RD_PARTY_NAME/.gitignore
./.git
./.gitignore
git 状态说:
# On branch develop
nothing to commit (working directory clean)
如果您需要更多信息,请告诉我。
谢谢
最佳答案
要将第三方添加为子模块:
git submodule add git@mygithost:3RD_PARTY_NAME libs/3RD_PARTY_NAME
关于子模块的好读物http://chrisjean.com/2009/04/20/git-submodules-adding-using-removing-and-updating/
我通常会尽量避免使用子模块,因为它们是后面的一个痛苦。 :)
关于Git错误: "is in submodule",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13881694/