kz4egw
Last Updated: March 07, 2016
·
13.25K
· brianwebb01
Bwebb

Composer install Github Rate Limiting work around

Often when setting up or deploying Laravel applications you need to run composer install or composer update which can often hit GitHub a lot. Chances are pretty good that you'll hit GitHub's rate limit and your composer install may fail.

You can get around this by creating an API token. Here's how.

Log into your GitHub account and click on "Applications" in the sidebar.

Picture

Then you'll want to create a new token under the "Personal Access Tokens" area:

Picture

After giving your token a name you'll be presented with the actual token's hash string.

Now you'll want to add this token to your composer.json file so that when you are running a composer install you can utilize this token to avoid rate limiting on GitHub. So, just cd into the directory with your composer.json file in it and issue the command:

composer config github-oauth.github.com YOUR-TOKEN-HASH-GOES-HERE

Now you can checkout your composer.json file and you should see something like:

"config": {
  "preferred-install": "dist",
    "github-oauth": {
      "github.com": "YOUR-TOKEN-HASH-GOES-HERE"
  }
},

Now you should be able to avoid some of those nasty HTTP/1.1 403 Forbidden errors

Say Thanks
Respond

5 Responses
Add your response

11215
147186f2f9c90edfc509a0b045038736

ah great tips, i haven't deploy my laravel project with github, but this really help me if i want to push in github, thankyuu :D

over 1 year ago ·
12369
0d49c8ee20beed1096a4ca3a1bc08acf

If you're working on a collaborative project, you should not commit your key in the project source control. The alternative is to set your key in your home directory at ~/.composer/config.json.

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

over 1 year ago ·
15677

+1

over 1 year ago ·
21400
None

the better solution would be that composer was programmed to not scan for every version of a software, running into the api limits in the first place

over 1 year ago ·
22915
None

thanks for the help

over 1 year ago ·
Filed Under