Composer install命令覆盖.gitignore文件、Adobe Commerce
本文提供了一个解决方案,用于在Adobe Commerce上由编辑器在Cloud Infrastructure 2.4.2-p1和2.3.7上覆盖跟踪的.gitignore
文件。
受影响的产品和版本
云基础架构上的Adobe Commerce 2.4.2-p1和2.3.7。
问题
运行composer install命令时正在覆盖.gitignore
文件。
重现步骤:
-
为工作区创建一个空目录。
-
在根目录中运行此命令:
code language-bash composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition:2.4.2-p1.
#或2.3.7
-
然后运行以下命令:
-
echo "/this/line/should/stay" >> .gitignore
-
git init
-
git add * && git add .*
-
已提交到存储库的
git commit -m "Init"
#个文件 -
rm -rf vendor/*
-
composer install
-
git diff
code language-git diff --git a/.gitignore b/.gitignore index c144521..7092a56 100644 --- a/.gitignore +++ b/.gitignore @@ -70,4 +70,3 @@ atlassian* /generated/* !/generated/.htaccess .DS_Store -/this/line/should/stay
-
预期的结果:
.gitignore
未被编辑器覆盖。
实际结果:
每次运行composer时都会覆盖.gitignore
。
解决方案
要保留您的自定义.gitignore file
,您需要在magento-deploy-ignore
分区中忽略它。
{
...
"extra": {
"magento-deploy-ignore": {
"*": [
"/.gitignore"
]
}
...
}
8bd06ef0-b3d5-4137-b74e-d7b00485808a