简体   繁体   English

使用Composer时如何将文件添加到主存储库?

[英]How to add files to main repository when using composer?

In my PHP project I use composer. 在我的PHP项目中,我使用composer。 For some reasons (stupid, but it's not depending on me) I must store all project files in a git repository, including "vendor/" files fetched by composer. 由于某些原因(愚蠢,但这不取决于我),我必须将所有项目文件存储在git存储库中,包括由作曲家获取的“ vendor /”文件。 I've removed "vendor/" from the .gitignore file, but some modules (like https://github.com/RWOverdijk/AssetManager ) are treated as submodules - and they are not being added to the repository ( git add ignores them). 我已经从.gitignore文件中删除了“ vendor /”,但是某些模块(例如https://github.com/RWOverdijk/AssetManager )被视为子模块-并且它们未添加到存储库中( git add忽略它们) )。

What do I need to do, to force addition? 我需要做什么来强制添加?

You can use the following commands: 您可以使用以下命令:

# remove `.git` folders recursively
find vendor -type d -name '.git' -exec rm -rf {} \;
# Add the vendor folder
git add vendor

Probably it would be better to persuade your boss that composer isn't meant to work like that. 说服您的老板作曲家并非要那样做可能会更好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM