I have an old website (trellis+bedrock+sage) with a plugin hosted on a private Git repositories on Github.
I followed this guide Private or Commercial WordPress Plugins as Composer Dependencies | Roots the website went live years ago without any problem,
Recently I tried to update the private plugin, I added a new tag with the new plugin version and I updated the version in the composer.json and I run “composer update”.
on my local dev site I have no problem, I can update the plugin to the new version without any issue.
but when I try to deploy to the staging enviroment, it gets to “Install Composer dependencies” and it fails at the private repository.
this is the error output:
System info:
Ansible 2.9.8; Darwin
Trellis Head
---------------------------------------------------
non-zero return code
[UnexpectedValueException]
Your github oauth token for github.com contains invalid characters:
"ghp_xxxxxxxxxxxxxxx"
fatal: [xx.xx.x.xxx]: FAILED! => {"changed": true, "cmd": ["composer", "install", "--no-ansi", "--no-dev", "--no-interaction", "--no-progress", "--optimize-autoloader", "--no-scripts"], "delta": "0:00:00.110670", "end": "2022-04-07 13:31:54.402428", "rc": 1, "start": "2022-04-07 13:31:54.291758", "stderr_lines": ["", " ", " [UnexpectedValueException] ", " Your github oauth token for github.com contains invalid characters: \"ghp_xxxxxxxxxxxxxxx\" ", " "], "stdout": "", "stdout_lines": []}
I generated my github token, I can see the right token on my local by running " nano ~/.composer/auth.json
and as I said on my local dev site I can update the plugin correctly, but I can’t deploy anymore (I tried only on the staging for now) because of this “Your github oauth token for github.com contains invalid characters:”.
The github oauth token that I can see in the error, it is not the same that I can see by running nano ~/.composer/auth.json
, they are 2 different tokens, maybe this could be the problem?
but how can I say to the deploy that this is an old token and it needs to use the new one?
could it be a cache problem?
I run composer config -g github-oauth.github.com XXXXXXXXXXXXXXXXXXXXXXX
with the new token (just to be 100% sure that the token is the latest one)
I can ssh into the staging droplet, if this helps.
is there an extra step that I have to take in consideration in order to have a private WordPress plugins as Composer Dependencies hosted on github on staging/production enviroment? (I saw that this guide is 4 years old so maybe something changed and now there is an extra step needed)
Could someone please point me to the right direction?
thanks