Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composer authentication (Could not authenticate against github.com) #404

Closed
3 of 5 tasks
w00fz opened this issue Feb 1, 2021 · 3 comments
Closed
3 of 5 tasks

Composer authentication (Could not authenticate against github.com) #404

w00fz opened this issue Feb 1, 2021 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@w00fz
Copy link

w00fz commented Feb 1, 2021

Describe the bug

We are constantly getting the infamous "Error: Could not authenticate against github.com" like appears in #332

I think the problem is that composer config global is being used to authenticate as seen for example in https://github.com/shivammathur/setup-php/blob/develop/src/scripts/common.sh#L197 - However as per documentation it should be composer config --global (reference).

I also think I know why the confusion, and that is because the command composer global is legitimate but not related with composer config --global.

Does this make sense? Am I on the right track here? We have spent so much time trying to figure out why our commits/PRs constantly fail due to authentication and this is right now the only logical explanation I found.

Places where this is an issue:

  1. composer -q global config process-timeout 0
  2. composer -q global config github-oauth.github.com "$COMPOSER_TOKEN"
  3. composer -q global config process-timeout 0
  4. composer -q global config github-oauth.github.com $env:COMPOSER_TOKEN

Version

  • I have checked releases, and the bug exists in the latest patch version of v1 or v2.
  • v2
  • v1

Runners

  • GitHub Hosted
  • Self Hosted

Operating systems
Linux, Ubuntu

PHP versions

  • 7.3
  • 7.4
  • 8.0

Are you willing to submit a PR?
Of course, I want to make sure this is the right problem.

@w00fz w00fz added the bug Something isn't working label Feb 1, 2021
@shivammathur
Copy link
Owner

@w00fz
The difference between the 2 commands is, by default:

  • composer global config updates the composer.json in COMPOSER_HOME. Reference
  • composer config --global updates the config.json in COMPOSER_HOME. Reference

Upon testing, you are right as composer does not use the config in composer.json file, but it uses the config.json file. So I will change the commands.

@shivammathur
Copy link
Owner

Fixed in 46fc8a2

@w00fz
Copy link
Author

w00fz commented Feb 2, 2021

Thank you for the quick fix @shivammathur

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants