Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

composer update gives a 404 about a private repository metadata

I installed laravel/homestead and tried 'composer update'. Composer gives me an TransportException about a private repo.

Composer update
Loading composer repositories with package information
Your GitHub credentials are required to fetch private repository metadata (https://github.com/GrahamCampbell/asset)
A token will be created and stored in "/home/vagrant/.composer/auth.json", your password will never be stored
To revoke access to this token you can visit https://github.com/settings/applications
Username:
Password:
Token successfully created
[Composer\Downloader\TransportException]
The "https://api.github.com/repos/GrahamCampbell/asset" file could not be downloaded (HTTP/1.1 404 Not Found)

I can't pass this point so I'm stuck.

like image 369
Bahjaat Avatar asked Mar 29 '15 21:03

Bahjaat


People also ask

How do I update my composer?

update / u# In order to get the latest versions of the dependencies and to update the composer. lock file, you should use the update command. This command is also aliased as upgrade as it does the same as upgrade does if you are thinking of apt-get or similar package managers.

How do I update composer json?

To update your packages json file is. Run composer update (on your local machine) to update the required packages and re-generate a composer. lock file. Commit the updated composer.

What is repositories in composer json?

A repository is a package source. It's a list of packages/versions. Composer will look in all your repositories to find the packages your project requires. By default, only the Packagist.org repository is registered in Composer. You can add more repositories to your project by declaring them in composer.


1 Answers

If you have access to the private repo, you can use SSH Keys in composer.

Otherwise you can use GitHub API Tokens.

$ export GITHUB_ACCESS_TOKEN=hash-to-your-api-token
$ composer config -g github-oauth.github.com $GITHUB_ACCESS_TOKEN
$ composer install

If you are using Vagrant, you can add an environment variable and the composer configuration in your provisioner.

At the moment of writing the page to generate a new access token on GitHub can be found under Settings / Developer settings / Personal access tokens.

like image 137
acfreitas Avatar answered Sep 23 '22 11:09

acfreitas