Composer install 명령은 .gitigore 파일, Adobe Commerce을 감독합니다.

이 문서에서는 추적된 .gitignore 파일이 클라우드 인프라 2.4.2-p1 및 2.3.7의 Adobe Commerce에서 작성기에 의해 재정의되는 경우에 대한 솔루션을 제공합니다.

영향을 받는 제품 및 버전

클라우드 인프라 2.4.2-p1 및 2.3.7의 Adobe Commerce.

문제

composer install 명령을 실행할 때 .gitignore 파일을 덮어쓰는 중입니다.

재현 단계:

  1. 작업 공간에 대한 빈 디렉토리를 만듭니다.

  2. 루트 디렉터리에서 이 명령을 실행합니다.

    code language-bash
    composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition:2.4.2-p1.
    

    # 또는 2.3.7

  3. 그런 다음 다음 다음 명령을 실행합니다.

    1. echo "/this/line/should/stay" >> .gitignore

    2. git init

    3. git add * && git add .*

    4. 저장소에 커밋된 파일 git commit -m "Init"

    5. rm -rf vendor/*

    6. composer install

    7. 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은(는) 작성기에 의해 재정의되지 않았습니다.

실제 결과:

.gitignore은(는) 모든 작성기 설치 실행에서 재정의됩니다.

솔루션

사용자 지정 .gitignore file을(를) 유지하려면 magento-deploy-ignore 섹션에서 무시해야 합니다.

{
...
"extra": {
    "magento-deploy-ignore": {
        "*": [
            "/.gitignore"
        ]
    }
    ...
}

관련 읽기

recommendation-more-help
8bd06ef0-b3d5-4137-b74e-d7b00485808a