【问题标题】:Unable to add all the files to git downloaded via composer无法将所有文件添加到通过 composer 下载的 git
【发布时间】: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 的任何文件。如果我注释掉.gitignorevendor 行并检查状态,它会显示为:

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


【解决方案1】:

在您评论 .gitignore 文件后,您是否真的添加了 imgix-php 文件,使用

git add /path/to/folder/* 

git add --all /path/to/folder 

?

【讨论】:

    猜你喜欢
    • 2021-06-16
    • 2013-02-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-21
    • 2016-10-31
    • 1970-01-01
    • 2020-02-11
    相关资源
    最近更新 更多