cachet icon indicating copy to clipboard operation
cachet copied to clipboard

GitHub API rate limit when using composer during installation

Open axilleas opened this issue 10 years ago • 13 comments

In the last two dependencies composer stops and waits for a GitHub token. Not a blocker, since just pressing enter it continues, but can this be circumvented somehow? Thanks :)

  - Installing rcrowe/twigbridge (v0.9.0)
    Downloading: Connecting...
Could not fetch https://api.github.com/repos/rcrowe/TwigBridge/zipball/f875fa9457ebadf8f24b683b226848b660407f8f, please create a GitHub OAuth token to go over the API rate limit
Head to https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+debian-jessie+2015-12-13+2220
to retrieve a token. It will be stored in "/root/.composer/auth.json" for future use by Composer.
Token (hidden): 
No token given, aborting.
You can also add it manually later by using "composer config github-oauth.github.com <token>"
    Failed to download rcrowe/twigbridge from dist: Could not authenticate against github.com
    Now trying to download from source
  - Installing rcrowe/twigbridge (v0.9.0)
    Cloning f875fa9457ebadf8f24b683b226848b660407f8f

  - Installing roumen/feed (v2.9.7)
    Downloading: Connecting...
Could not fetch https://api.github.com/repos/RoumenDamianoff/laravel-feed/zipball/4611e281e28934b17c564be8f709ac99176cf5f9, please create a GitHub OAuth token to go over 
the API rate limit
Head to https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+debian-jessie+2015-12-13+2239
to retrieve a token. It will be stored in "/root/.composer/auth.json" for future use by Composer.
Token (hidden): 
No token given, aborting.
You can also add it manually later by using "composer config github-oauth.github.com <token>"
    Failed to download roumen/feed from dist: Could not authenticate against github.com
    Now trying to download from source
  - Installing roumen/feed (v2.9.7)
    Cloning 4611e281e28934b17c564be8f709ac99176cf5f9

axilleas avatar Dec 13 '15 22:12 axilleas

Yes. The thing you've pasted there actually has instructions for you. ;)

GrahamCampbell avatar Dec 13 '15 22:12 GrahamCampbell

Head to https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+debian-jessie+2015-12-13+2239 to retrieve a token. It will be stored in "/root/.composer/auth.json" for future use by Composer.

GrahamCampbell avatar Dec 13 '15 22:12 GrahamCampbell

Thanks I know that :p I was just wondering if there was a better way. I'm actually writing an article for DigitalOcean and I'm documenting all the details.

axilleas avatar Dec 13 '15 22:12 axilleas

I think that's the best way. Well, doing that before you start is the best way. ;)

GrahamCampbell avatar Dec 13 '15 23:12 GrahamCampbell

That's one of the thing's I'd recommend doing as part of the installation process of composer tbh.

GrahamCampbell avatar Dec 13 '15 23:12 GrahamCampbell

So far, using composer install --prefer-source --no-interaction --no-dev -o seems to have no issues and bypasses the API as it fetches from source.

eveandcats avatar Dec 14 '15 03:12 eveandcats

Thanks for your answers :) @ALinuxNinja that is interesting, didn't know about that. I see that there are two ways declared in composer.lock, source and dist, and reading the composer docs it now makes sense.

axilleas avatar Dec 14 '15 07:12 axilleas

I'd still recommend NOT using --prefer-source, because using dist will give you a much smaller vendor folder due to no git clone, and also due to the fact that it only downloads the actual code, without the tests and the readmes and stuff.

GrahamCampbell avatar Dec 14 '15 10:12 GrahamCampbell

@GrahamCampbell thanks for the clarification :)

axilleas avatar Dec 14 '15 13:12 axilleas

:+1: on the not using --prefer-source if possible. People can also use their regular GitHub OAuth tokens with composer as well instead of making a new one. Can't wait for the article!

GenPage avatar Dec 15 '15 17:12 GenPage

Ok got it, dist is the recommended one. I'll make sure the benefits are stressed out, thanks everyone!

axilleas avatar Dec 15 '15 21:12 axilleas

So far, using composer install --prefer-source --no-interaction --no-dev -o seems to have no issues and bypasses the API as it fetches from source.

That remove all my packages. Thank you. Next time I will think what im doing.

LordJohn42 avatar Nov 30 '18 08:11 LordJohn42

el proyecto debe tener un token generado como indicaron mas arriba. Ése debes pegarlo en la terminal cuando te lo pida el composer

cosmeefulanito avatar Feb 07 '19 16:02 cosmeefulanito