How to make composer NOT create a .git directory for a package

前端 未结 3 2022
挽巷
挽巷 2021-01-03 21:46

I found a couple related posts, but those don\'t really answer my question. Let\'s say I want to install this package: https://github.com/pear/Net_Socket

an excerpt

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-03 22:32

    Using --prefer-dist is the only native solution, but there will be situations where there is simply no packaged version available, and in those cases Composer will still fall back to git clones.

    The only workaround I know of is to run a cleanup script after composer install that removes Git directories. Maybe a command like this:

    find . -type d | grep .git | xargs rm -rf
    

    Be careful to run this in your vendor directory, not your root directory.

提交回复
热议问题