Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dotherightthing/56e7b2d62ea02546bbe1146d494294c7 to your computer and use it in GitHub Desktop.
Save dotherightthing/56e7b2d62ea02546bbe1146d494294c7 to your computer and use it in GitHub Desktop.
[Remove incorrect authentication password from Composer config] #github

Remove incorrect authentication password from Composer config

Background

Whilst migrating my Yeoman dependency install to a bash script (that I could also run later), I inadvertently set my Github OAuth password to the string "process.env.GH_TOKEN".

Error

[UnexpectedValueException]                                                                  
  Your github oauth token for github.com contains invalid characters: "process.env.GH_TOKEN"

Tried

Realising my error, I tried to change the string to a new value:

composer config -g github-oauth.github.com $GH_TOKEN

This didn't work, so then I tried to unset the bad value:

composer config -g --unset github-oauth.api.github.com 

This also didn't work.

Solution

The solution was to manually delete the file used by Composer to store this information:

  1. Navigate to COMPOSER_HOME
  2. Delete auth.json

Further reading

  1. Composer: HTTP basic authentication
  2. Composer [UnexpectedValueException] error will trying to use composer to install a github project
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment