Could not fetch [repository], please review your configured GitHub OAuth token when running "composer update"

Viewed 2580

When I run composer update, I get the following error:

Could not fetch https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf, please review your configured GitHub OAuth token or enter a new one to access private repos. When working with public GitHub repositories only, head to https://github.com/settings/tokens/new?scopes=&description=Composer to retrieve a token.

Then I go to "https://github.com/settings/tokens/new", generate a new token and set it using the following command:

composer config --global github-oauth.github.com [token]

even after that, when I run composer update I get the same error. How can I fix this?

2 Answers

I just had the same problem and it was due to incorrect credentials in my auth.json file. Two suggestions:

  • Either define the correct credentials in the auth.json file as described in the docs:
{
    "http-basic": {
        "example.org": {
            "username": "username",
            "password": "password"
        }
    },
    "github-oauth": {
        "github.com": "ghp_your_token_here"
    }
}
  • Or if you don't need this, just delete the auth.json file.

Hope that this helps!

You are missing --auth in the command. The command should be:

composer config --global --auth github-oauth.github.com [token]
Related