In my composer.json i have a private vcs repository:
{
"type": "vcs",
"url": "https://github.com/username/repo.git"
}
When i call php composer.phar update
i get the following:
Your GitHub credentials are required to fetch private repository metadata (https://github.com/username/repo.git)
The credentials will be swapped for an OAuth token stored in /root/.composer/config.json, your password will not be stored
To revoke access to this token you can visit https://github.com/settings/applications
Username: myusername
Password:
Authentication required (api.github.com):
Username: myusername
Password:
Authentication required (api.github.com):
Username: myusername
Password:
Authentication required (api.github.com):
Username:
Doesnt matter how many time I put in my my github credentials it keeps asking. If i put in incorrect ones it does the same thing, no errors or max attempts.
Any ideas what would cause this? I am using the latest version as retrievable by running:
php composer.phar self-update
WORK AROUND
As a work around for now i have gone to: https://github.com/settings/applications and generated a token manually then ran:
php composer.phar config -g github-oauth.github.com <token>
But i would still like to know why it couldnt do it automatically
In this authentication storage method, an auth. json file will be present in the same folder as the projects' composer. json file. You can either create and edit this file using the command line or manually edit or create it.
Composer: Enables you to declare the libraries you depend on. Finds out which versions of which packages can and need to be installed, and installs them (meaning it downloads them into your project). You can update all your dependencies in one command.
Composer makes information about the environment Composer runs in available as virtual packages. This allows other packages to define dependencies (require, conflict, provide, replace) on different aspects of the platform, like PHP, extensions or system libraries, including version constraints.
This is because the current version of composer aa74818fe00c5f5eb57c1c38b807e9e2950c670c
does not support GitHubs 2 factor authorization. So any account that have that setup will have this issue.
There has been a pull request created for it and it should be good to go in one of the upcoming version updates.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With