Using Composer with Private GitHub Repositories via HTTPS

We have several private repositories that we would like to include in a PHP application using Composer. The file composer.jsoncontains this entry, which defines our first private repository:

"repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/vendor/package.git"
    }
]

Then we need a repository, as usual:

"require": {
    "vendor/package": "~1.0.0"
}

The only thing I did was set the private access token on GitHub and save it in the composers file auth.json. It looks like this:

{
    "github-oauth": {
        "github.com": "<my_access_token>"
    }
}

It all looks like Composer is properly configured to access GitHub via HTTPS using an access token, but we get errors that look like this:

[RuntimeException]
Failed to clone https://github.com/vendor/package.git via https protocols, aborting.
 - https://github.com/vendor/package.git
   Cloning into bare repository '/home/vagrant/.composer/cache/vcs/https---github.com-vendor-package.git'...
   remote: Invalid username or password.
   fatal: Authentication failed for 'https://github.com/vendor/package.git/'

The access token is valid because I used it to overcome the speed list exceeded above, and it appears on GitHub as recently used.

? , Composer GitHub. Satis Trojan - , . , , .

+4
1

HTTPS :

"repositories": [
    {
        "type": "vcs",
        "url": "git@github.com:vendor/package.git"
    }
]

, .

: https://getcomposer.org/doc/05-repositories.md#using-private-repositories

+4

Source: https://habr.com/ru/post/1606415/


All Articles