我有以下内容composer.json
:
{
"require": {
"php": ">=5.2.0",
"queueit/KnownUser.V3.PHP": "dev-master"
},
"config": {
"autoloader-suffix": "ComposerManager",
"vendor-dir": "../../../all/libraries/composer"
},
"prefer-stable": true,
"repositories": [
{
"type": "package",
"package": {
"name": "queueit/KnownUser.V3.PHP",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/queueit/KnownUser.V3.PHP.git",
"reference": "master"
}
}
}
]
}
但是,当我运行时:
$ composer -vvv update
...
Cloning master
Executing command (CWD): git clone --no-checkout 'https://github.com/queueit/KnownUser.V3.PHP.git' '.../sites/all/libraries/composer/queueit/KnownUser.V3.PHP' && cd '.../sites/all/libraries/composer/queueit/KnownUser.V3.PHP' && git remote add composer 'https://github.com/queueit/KnownUser.V3.PHP.git' && git fetch composer
克隆过程需要很长时间,并且存储库的大小超过 25MB:
$ du -hs ~/.composer/cache/vcs/https---github.com-queueit-KnownUser.V3.PHP.git/
25M ~/.composer/cache/vcs/https---github.com-queueit-KnownUser.V3.PHP.git/
然后 Composer 因超时而停止:
[Symfony\Component\Process\Exception\ProcessTimedOutException]
进程“git clone --no-checkout 'https://github.com/queueit/KnownUser.V3.PHP.git' '.../sites/all/libraries/composer/queueit/KnownUser.V3.PHP' && cd '.../sites/all/libraries/composer/queueit/KnownUser.V3.PHP' && git remote add composer 'https://github.com/queueit/KnownUser.V3.PHP.git' && git fetch composer
”超过了 300 秒的超时时间。
我假设存储库太大而无法克隆所有 git 对象。
如何使用浅克隆更快地克隆存储库?
例如,通过将额外--depth 1
或--single-branch
git 参数传递给 Git 命令,以便 Composer 可以自动获取它?
我希望更改在文件中是自包含的composer.json
,因此在其他系统上调用此文件或由其他用户在运行composer install
.