Composer & GitHub Authentication
If you receive an error within Composer such as
Could not authenticate against github.com, this usually means you are hitting API rate limits.
It may look something like this:
[Composer\Downloader\TransportException] Could not authenticate against github.com
- Installing phpunit/phpunit (7.5.1) Downloading: connection... Failed to download phpunit/phpunit from dist: Could not authenticate against github.com` Now trying to download from source
To get around this, you can create a personal access token within a GitHub's user settings. For installing open source projects via Composer, GitHub just needs a user authenticated to allow higher API limits. The GitHub user likely doesn't need any particular repository access unless you are using private repositories.
Once the personal access token is created, you can add the following to the project pipeline before the
composer install command:
composer config github-oauth.github.com a-personal-access-token-here
Chipper CI projects based on GitHub should already have a oauth token setup for authentication (a feature of Chipper CI's). However, Bitbucket and GitLab based projects don't have this available and are therefore more likely to encounter this issue.