Composer 没有为包生成 .git 文件夹

2022-01-21 00:00:00 php composer-php

这很奇怪,好像我错过了一些小东西.几天前,当我 composer install 时,我得到了带有自己的 .git 的 Vendor 目录,这使我可以进行更改并更新自己的打包存储库.

This is weird, seems like something small that I'm missing. A few days ago, when I composer install I get Vendor directories with their own .git, this allows me to make changes and update my own packaged repositories.

今天运行composer install后,每个包文件夹内的.git目录不见了!(我认为这可能与从缓存安装有关?)

Today, after running composer install, the .git directories inside each package folder is missing! (I think this might have something to do with installing from cache?)

有人可以尝试重新创建这个吗?

Could someone please try re-create this?

$ git clone https://github.com/nathankot/rbhpi
$ cd rbhpi
$ ./composer.phar install
$ cd vendor/rbhpi/core
$ ls -a

从上面的命令中,.git 目录对我来说是缺失的.

From the above commands, the .git directory is missing for me.

我在文档中找不到这个规范,但我确实在 这个常见问题项目:

I couldn't find this spec in the docs, but I did find it in this faq item:

安装后删除所有依赖的.git目录

Remove the .git directory of every dependency after the installation

我的问题有什么解决方案吗?

Any solutions to my problem?

推荐答案

Composer 更喜欢你的依赖项的 dist 包,这意味着从 github 下载 .tgz 并解压它.如果您想要源代码,请使用

Composer prefers the dist package of your dependencies, meaning dowloading a .tgz from github and unpacking it. If you want the source, install your vendors with

composer install --prefer-source

这会像你想要的那样做一个 git checkout.

This will do a git checkout like you want.

相关文章