Cookies ahead

Our support chat tool "Intercom" would like to collect some more data on you. See the related link for more details.

Docs

GitHub API limits and Composer

Reviewed

Markdown ↓

⏱️

Handle GitHub API rate limits.

The reason why you can run into this issue temporarily is that GitHub limits it's API per IP.

The solution is to create a GitHub OAuth token and put it in your composer.json file. You can do so by visiting https://github.com/settings/tokens or via terminal:

curl -u your-github-user -d '{"note": "Fortrabbit Auth"}' https://api.github.com/authorizations
bash

If you are using multi factor authentication (OTP), then you need to provide a valid OTP token like so:

curl -u your-github-user -H 'X-GitHub-OTP: 123456' -d '{"note": "Fortrabbit Auth"}' https://api.github.com/authorizations
bash

This will give you a response like the following:

{
  "id": 123456,
  "url": "https://api.github.com/authorizations/123456",
  "app": {
    "name": "Fortrabbit Auth (API)",
    "url": "http://developer.github.com/v3/oauth/#oauth-authorizations-api",
    "client_id": "12345abc12345"
  },
  "token": "12345abc1234512345",
  "note": "Fortrabbit Auth",
  "note_url": null,
  "created_at": "2013-08-08T11:08:18Z",
  "updated_at": "2013-08-08T11:08:18Z",
  "scopes": []
}
json

What you need is the token value. In the above example it is 12345abc1234512345. Open up your composer.json file and add the token under the config directive:

{
  "require": {
    "awesome/package": "@dev"
  },
  "config": {
    "github-oauth": {
      "github.com": "12345abc1234512345"
    }
  }
}
json

That's it. Your API token will be used to give you a personal rate limit which is much more higher than the default one.

Written by a human. Review, grammar checks and typo fixes by AI.

AI use & editorial processEdit on GitHub ↗