Use PHP composer to clone git repo

后端 未结 8 1178
难免孤独
难免孤独 2020-11-30 16:57

I\'m trying to use composer to automatically clone a git repository from github that isn\'t in packagist but it\'s not working and I can\'t figure out what am I doing wrong.

8条回答
  •  南笙
    南笙 (楼主)
    2020-11-30 17:26

    Just tell composer to use source if available:

    composer update --prefer-source
    

    Or:

    composer install --prefer-source
    

    Then you will get packages as cloned repositories instead of extracted tarballs, so you can make some changes and commit them back. Of course, assuming you have write/push permissions to the repository and Composer knows about project's repository.

    Disclaimer: I think I may answered a little bit different question, but this was what I was looking for when I found this question, so I hope it will be useful to others as well.

    If Composer does not know, where the project's repository is, or the project does not have proper composer.json, situation is a bit more complicated, but others answered such scenarios already.

提交回复
热议问题