Use PHP composer to clone git repo

后端 未结 8 1177
难免孤独
难免孤独 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条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-30 17:35

    I was encountering the following error: The requested package my-foo/bar could not be found in any version, there may be a typo in the package name.

    If you're forking another repo to make your own changes you will end up with a new repository.

    E.g:

    https://github.com/foo/bar.git
    =>
    https://github.com/my-foo/bar.git
    

    The new url will need to go into your repositories section of your composer.json.

    Remember if you want refer to your fork as my-foo/bar in your require section, you will have to rename the package in the composer.json file inside of your new repo.

    {
        "name":         "foo/bar",
    
    =>
    
    {
        "name":         "my-foo/bar",
    

    If you've just forked the easiest way to do this is edit it right inside github.

提交回复
热议问题