【发布时间】:2017-09-13 20:50:26
【问题描述】:
我在依赖作曲家的drupal 中使用imgix 模块。当我运行命令drush composer-manage install 时,我可以看到imgix-php(imgix 库)已下载到供应商目录中。我已经正确设置了所有内容,并且在我的本地主机中运行良好。现在我想把它们推到 github 上。我看不到imgix-php 的文件没有添加到git 中,它在github 中是空的。然后我看到imgix-php 中有一个文件.gitignore,其中写入了vendor。但是,我已经将其注释掉了。但无法添加imgix-php 的任何文件。如果我注释掉.gitignore 的vendor 行并检查状态,它会显示为:
On branch staging
Your branch is up-to-date with 'origin/staging'.
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: sites/all/vendor/imgix/imgix-php (modified content)
no changes added to commit (use "git add" and/or "git commit -a")
可以告诉我为什么我不能添加它们。
【问题讨论】:
-
通常你会在 .gitignore 中阻止 /vendor,并将你的 composer.lock 提交到 repo。然后,任何从 repo 安装的人都会“composer install”以从源代码获取库。 getcomposer.org/doc/faqs/…
-
实际上我的生产服务器从 github 拉取。所以我应该在 git 中添加完整的源代码。有没有办法添加所有通过composer下载的文件?
-
该链接中有指导(通常在 getcomposer.org 网站上),可能会对您有所帮助。它在“如果你真的觉得你必须这样做,你有几个选择”部分下
-
@StreetCoder 想一想以防万一您还没有检查,请确保您没有在全局 gitignore 中配置
vendor。即~/.gitignore。另外,drupal 根目录是您存储库的根目录吗?不确定您的.gitignore文件在哪里,但如果您的存储库中存在较低级别,请确保 drupal 根目录下没有其他文件。
标签: php git drupal-7 composer-php imgix-js