I cannot download github private repos with composer
php composer.phar update
I get the following error
The "https://api.github.com/repos/company/private1" file could not be downloaded (HTTP/1.1 404 Not Found)
but i can easily download these private repos using git clone
Composer.json
"repositories": [
{
"type": "vcs",
"url": "[email protected]:company/private1.git",
"options": {
"ssh2": {
"username": "githubusername",
"pubkey_file": "/home/username/.ssh/id_rsa.pub",
"privkey_file": "/home/username/.ssh/id_rsa"
}
}
},
{
"type": "vcs",
"url": "[email protected]:company/private2.git",
"options": {
"ssh2": {
"username": "githubusername",
"pubkey_file": "/home/username/.ssh/id_rsa.pub",
"privkey_file": "/home/username/.ssh/id_rsa"
}
}
}
],
"require": {
"php": ">=5.4.3",
"zendframework/zendframework": ">2.1.3",
"doctrine/mongodb-odm": "dev-master",
"doctrine/doctrine-mongo-odm-module": "dev-master",
"company/private": "dev-master",
"company/private2": "dev-master"
}
I tried with this but it doesnot work
SSH2 PECL is also enabled.
I have also created config file vim ~/home/.ssh/config
with the following details
host www.github.com
User githubusername
HostName github.com
IdentityFile /home/username/.ssh/id_rsa
but still i cannot download the private repos using composer
Private Packagist is a commercial package hosting product offering professional support and web based management of private and public packages, and granular access permissions.
Composer downloads directly from the source, e.g. Packagist only knows those source and tells your composer instance where to go. It does this by downloading a bunch of json files from Packagist.org that have all the infos.
composer. lock records the exact versions that are installed. So that you are in the same versions with your co-workers. composer install. Check for composer.lock file.
In your composer.json file, you do not need the options in your repository section, just the type
and url
.
Over on GitHub, under Profile...Settings
, there is a SSH and GPG Keys
tab. This is where you load up the public side of your SSH key to access GitHub from your machine (where the private key is stored).
See their documentation Generating an SSH Key which steps you through this process. It also steps you through the SSH Agent storage for the private side of the key.
When you invoke composer install
if you have not set up an access token, but need one, Composer will prompt you to generate it and a URL to use to accomplish this. You can use that URL and it will generate a once-seen API token that you then load up on composer to access GitHub. From the GitHub website:
Personal access tokens function like ordinary OAuth access tokens. They can be used instead of a password for Git over HTTPS.
If you don't see this automatic prompt, then here is how to do it manually:
GitHub...Settings...Personal
access tokensGenerate new token
buttonToken Description
repo
checkbox (it will automatically check the three checkboxes underneath)Generate token
button at the bottom of the pageBack on your server, tell composer about the token:
composer config -g github-oauth.github.com <token>
composer install
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