Disable composer cache for git clone

When composer tries to clone my git repo from Bitbucket, it loads it from cache. Where the latest commits from master are not loaded which results in an outdated repo. Clearing the composer cache each time seems cumbersome. I want to force composer to load this repo never from cache. --prefer-source could do the trick. But how do go about this in the best way. How to add the force no cache in the code below?

 "mybbrepo": {
        "type": "package",
        "package": {
            "name": "project/mybbrepo",
            "version": "1.0",
            "type": "drupal-theme-custom",
            "source": {
                "url": "git@bitbucket.org:project/mybbrepo.git",
                "type": "git",
                "reference": "master"
             }
        }
    },

1 answer

  • answered 2018-11-08 12:31 rob006

    The problem is not in Composer's cache - you're using incorrect type for repository. You should use vcs as a type:

    "mybbrepo": {
        "type": "vcs",
        "url": "git@bitbucket.org:project/mybbrepo.git"
    },
    

    package type should be used only for non-composer packages (without composer.json file inside) - usually you should avoid it, since it has many limitations:

    Note: This repository type has a few limitations and should be avoided whenever possible:

    • Composer will not update the package unless you change the version field.
    • Composer will not update the commit references, so if you use master as reference you will have to delete the package to force an update, and will have to deal with an unstable lock file.