git - 即使我正在使用子模块,也会警告嵌入 Git 存储库
问题描述
我试图弄清楚 Git 子模块是如何工作的。我在线阅读了很多文档并设法将子模块添加到我的项目中。这似乎可行,但由于某种原因,我在终端中不断收到此警告:
warning: adding embedded git repository: web/modules/custom/svds_adminmenu
hint: You've added another git repository inside your current repository.
hint: Clones of the outer repository will not contain the contents of
hint: the embedded repository and will not know how to obtain it.
hint: If you meant to add a submodule, use:
hint:
hint: git submodule add <url> web/modules/custom/svds_adminmenu
hint:
hint: If you added this path by mistake, you can remove it from the
hint: index with:
hint:
hint: git rm --cached web/modules/custom/svds_adminmenu
hint:
hint: See "git help submodule" for more information.
我觉得这很奇怪,因为 svds_adminmenu 存储库是我作为子模块添加的存储库。那么为什么它仍然给我这个警告。
我所做的如下:
git clone path/repo.git
在此之后,我使用了以下内容
git submodules update --init
当我对 .gitignore 文件进行更改并执行以下操作时,我在终端中收到此警告:
git rm -r --cached
git add --all
git commit -m '.gitignore changed'
出了什么问题?
解决方案
您可以删除子文件夹中的 .git 文件夹,然后使用
git add the_child_folder
git commit -m 'commit message'
推荐阅读
- bash - 如果前一行是前缀,则删除行(从输出中省略)
- python - 即使使用 pip 成功安装后,也没有名为“cv2”的模块
- javascript - 将 JS Web 程序集导入 TypeScript
- php - PHP 中的 REST API 请求 - 查询错误
- javascript - 减少中的连接不起作用?
- android - Firebase 回收器视图适配器
- computer-vision - 平均 SIFT 特征进行姿态估计
- php - 如何按条件过滤内爆结果?
- python - 多处理:主进程未终止
- c++ - boost multi_index - 如果元素的类型是仅移动,如何将元素从一个容器添加到另一个容器?