gpt4 book ai didi

git - 为 git clone 禁用 Composer 缓存

转载 作者:行者123 更新时间:2023-12-05 06:29:47 24 4
gpt4 key购买 nike

当 composer 尝试从 Bitbucket 克隆我的 git 存储库时,它会从缓存中加载它。未加载来自 master 的最新提交会导致过时的 repo 。每次清除 Composer 缓存似乎很麻烦。我想强制 Composer 永远不要从缓存中加载这个 repo。 --prefer-source 可以解决问题。但是如何以最好的方式解决这个问题。如何在下面的代码中添加强制无缓存?

 "mybbrepo": {
"type": "package",
"package": {
"name": "project/mybbrepo",
"version": "1.0",
"type": "drupal-theme-custom",
"source": {
"url": "git@bitbucket.org:project/mybbrepo.git",
"type": "git",
"reference": "master"
}
}
},

最佳答案

问题不在 Composer 的缓存中 - 您使用的存储库类型不正确。您应该使用 vcs 作为类型:

"mybbrepo": {
"type": "vcs",
"url": "git@bitbucket.org:project/mybbrepo.git"
},

package type 应该只用于非 composer 包(里面没有 composer.json 文件)——通常你应该避免它,因为它有很多限制:

Note: This repository type has a few limitations and should be avoided whenever possible:

  • Composer will not update the package unless you change the version field.
  • Composer will not update the commit references, so if you use master as reference you will have to delete the package to force an update, and will have to deal with an unstable lock file.

关于git - 为 git clone 禁用 Composer 缓存,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53202456/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com