Solve composer github api limitation

  • February 10, 2015

Could not fetch X enter your GitHub credentials to go over the API rate limit

The problem is that composer is retrieving nearly all the packages from github using the anonymous access github API. In order to solve it you need to generate a token

  1. you need a github account (or ask a friend)
  2. go on your setting page here
  3. click on Generate new token

now two possibilities

1 - Put this token in one specific project

for this simply run

composer config -g github-oauth.github.com YOUR_TOKEN

or

php composer.phar config -g github-oauth.github.com YOUR_TOKEN

(depending on how you installed composer)

it will add that to your project’s composer.json file

2 - Put this token in your global composer configuration

If your project is an open-source or company project you may not want to commit your token on the git of your project/company

for this edit the file ~/.composer/config.json and put in it:

{
    "config": {
        "github-oauth": { "github.com": "YOUR_TOKEN" }
    }
}

that’s all folks!

Source: