【发布时间】:2017-11-05 21:53:44
【问题描述】:
我已将git 设置到我的项目以将修改推送到gitlab repository。
我从github 安装了一个插件,它位于/vendor/dereuromar/cakephp-queue
插件的目录下还有.git目录和其他与git相关的文件
当我将我的项目推送到gitlab 时,除此目录之外的所有内容都会推送。
当尝试git status 时,它会给出错误
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
(commit or discard the untracked or modified content in submodules)
modified: vendor/dereuromark/cakephp-queue (modified content, untracked content)
no changes added to commit (use "git add" and/or "git commit -a")
我尝试从vendor/dereuromark/cakephp-queue 中删除.git 目录、.gitignore 和.gitattributes 目录。
git status 的输出是
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
但是那个目录的内容并没有上传到gitlab。
如何推送这个目录的内容?我还没有创建任何submodule。
【问题讨论】:
-
您对子模块的工作方式存在根本性的误解。我建议阅读 Pro Git 中解释子模块的部分以及文档:使用子模块管理工作树更改是一项复杂的任务。
-
我说,我还没有创建任何子模块。插件目录因为包含
.git目录,被视为子模块。 -
似乎你错过了GIT的概念。您不能提交 .git 文件夹,因为它是存储库的管理文件夹,它是它的每个克隆,并且它不是由 GIT 管理和分发的存储库的一部分。
-
删除
.git文件夹后的内容。我已经从该目录中删除了所有与 git 相关的文件。即使它不起作用。 -
你确实有一个子模块,即使你没有自己创建一个。这反过来意味着您在超级项目中拥有 Git 所谓的“gitlink”条目。超级项目不包含子模块的全部代码;它仅包含子模块的顶级提交的哈希 ID(加上
.gitmodules中的辅助信息,以允许 Git 定位和克隆子模块)。
标签: git git-push git-untracked