Calamity Jane
Calamity Jane

Reputation: 2686

Where is my composer global config information stored in Ubuntu?

I added a wrong github token to my global composer configuration and cannot remove it again.

I did

composer config --global --auth github-oauth.github.com myWrongTokenDamn

Now I cannot overwrite it by executing it again with the correct token and I don't know where this information is stored to remove it manually.

The command to show where it is stored just gives me the error, that I am using the wrong token. Thanks I know that....

I use Ubuntu 18.04 and installed composer following these instructions and then moving the binary to /usr/bin/composer.

Reinstalling didn't help either, so the information clearly is not stored at /usr/bin/composer

Upvotes: 4

Views: 14002

Answers (2)

steven7mwesigwa
steven7mwesigwa

Reputation: 6720

For my case, on Windows O.S, this configuration is in:

C:\Users\<username here>\AppData\Roaming\Composer\auth.json
PS C:\Users\Paul\AppData\Roaming\Composer> dir

    Directory: C:\Users\Paul\AppData\Roaming\Composer

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d----           2/23/2020  3:20 PM                vendor
-a---           2/23/2020  3:14 PM             13 .htaccess
-a---           2/11/2021 11:56 PM        1936645 2020-02-04_12-58-49-1.9.3-old.phar
-a---           6/22/2022  7:13 PM        2205196 2021-01-27_16-09-27-2.0.9-old.phar
-a---           6/18/2024 10:13 AM             97 auth.json
-a---           2/23/2020  3:18 PM             63 composer.json
-a---           2/23/2020  3:20 PM          27516 composer.lock
-a---           6/18/2024 10:13 AM             21 config.json
-a---           8/24/2022 10:45 AM            799 keys.dev.pub
-a---           8/24/2022 10:45 AM            799 keys.tags.pub

C:\Users\Paul\AppData\Roaming\Composer\auth.json
{
    "github-oauth": {
        "github.com": "ghp_25ZovESkdKCCGUyGUyITs6GEY2c0GE1BsWZU"
    }
}

Upvotes: 1

Calamity Jane
Calamity Jane

Reputation: 2686

Weird solution:

I noticed that the behaviour did only occur, when I was within my current project, which had of course a composer.json file

What I did then I moved to my home directory and executed the the command again this time with the correct token:

composer config --global --auth github-oauth.github.com myCorrectLongToken

And the error message is gone.

While I am happy about the fix, it would be good if someone could explain what happened in the background.

Now

$ composer config --list

gives me the list of all settings including [home]

[home] /home/myUser/.config/composer

where everything is stored.

Upvotes: 15

Related Questions