Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 299
B Faley Avatar asked Sep 13 '25 17:09

B Faley


2 Answers

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

composer config --global --auth github-oauth.github.com [token]
like image 89
Shadrachodek Avatar answered Sep 15 '25 06:09

Shadrachodek


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!

like image 44
Bobby Iliev Avatar answered Sep 15 '25 06:09

Bobby Iliev