Composer install command overides .gitignore file, Adobe Commerce
This article provides a solution for when a tracked
.gitignore file is overriden by composer on Adobe Commerce on cloud infrastructure 2.4.2-p1 and 2.3.7.
Affected products and versions
Adobe Commerce on cloud infrastructure 2.4.2-p1 and 2.3.7.
.gitignore file is being overwritten when running composer install command.
Steps to reproduce:
Create an empty directory for your workspace.
Run this command in the root directory:
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition:2.4.2-p1.
# or 2.3.7
Then run the following commands:
echo "/this/line/should/stay" >> .gitignore
git add * && git add .*
git commit -m "Init" # file commited to repo
rm -rf vendor/*
diff --git a/.gitignore b/.gitignore
index c144521..7092a56 100644
@@ -70,4 +70,3 @@ atlassian*
.gitignore is not overriden by composer.
.gitignore is overriden by every composer install run.
To keep your custom
.gitignore file you need to ignore it in the