JohanVdR
JohanVdR

Reputation: 2880

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": "[email protected]:project/mybbrepo.git",
                "type": "git",
                "reference": "master"
             }
        }
    },

Upvotes: 3

Views: 2717

Answers (1)

rob006
rob006

Reputation: 22174

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": "[email protected]: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.

Upvotes: 1

Related Questions