composer create-project from self-hosted GitLab instance - composer-php

I'm trying to use the composer create-project vendor/name --repository=https://my.self-hosted-gitlab-instance.com/repository.git command to create project.
When I run the command I first have to put my credentials :
Authentication required (my.self-hosted-gitlab-instance.com):
Username: myusername
Password:
I enter the correct credentials but then I have :
[Composer\Downloader\TransportException]
Invalid credentials for 'https://my.self-hosted-gitlab-instance.com/myrepository.git/packages.json', aborting.

If you use URL for --repository value it will be treated as repository with type composer. If you want to use different type, you need to pass JSON with full repository configuration:
composer create-project vendor/name --repository='{"type": "vcs","url": "https://my.self-hosted-gitlab-instance.com/myrepository.git"}'
or
composer create-project vendor/name --repository='{"type": "gitlab","url": "https://my.self-hosted-gitlab-instance.com/myrepository.git"}'
--repository: Provide a custom repository to search for the package, which will be used instead of packagist. Can be either an
HTTP URL pointing to a composer repository, a path to a local
packages.json file, or a JSON string which similar to what the
repositories key accepts.
https://getcomposer.org/doc/03-cli.md#create-project

Related

Removing AWS secret manager from laravel project

I've cloned a laravel project from github private repo and trying to setup on my local. The project uses AWS secret manager, so when I try to run composer install I get secret manager error in WrappedHttpHandler.php and RequestException.php vendor files. I removed aws from composer.json file and deleted aws.php file from the config folder. But still can't run composer install command for setuping the project on my local machine.
So, do you know guys how to remove secret manager package from the Laravel(version 5.7) project?

Laravel Nova installation via composer fails on production server

I have added Laravel Nova to our application and purchased a license. On the local server everything works perfectly. However, when I try to deploy the updated application to our linux server and run composer update it says:
Failed to download laravel/nova from dist: /var/www/{myPath} does not exist and could not be created.
Now trying to download from source
Syncing laravel/nova (3.29.0) into cache
Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos
Head to https://github.com/settings/tokens/new It will be stored in "/var/www/{myPath}"
So I created a GitHub Token and added the Laravel Nova credentials to the auth.json file on the server too. Everything should be correct and it is working on the local copy as I said before. However, I am getting the following errors:
[RuntimeException]
Failed to execute git clone --mirror -- 'git#github.com:laravel/nova.git' '/var/www/{myPath}/.cache/composer/vcs/git-github.com-laravel-nova.git/'
Cloning into bare repository '/var/www/{myPath}/.cache/composer/vcs/git-github.com-laravel-nova.git'...
ERROR: Repository not found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
How could I solve this problem?
Deleting the /vendor directory and the composer.lock file and running composer install --optimize-autoloader --no-devsolved the problem.
I had a similar problem and finally figured out the cause and its due to the laravel/nova:3.29. A minor upgrade to 3.30 fixed the issue for me without having to delete the whole composer.lock file as it will update some other packages as well.
Create file at root directory with name "auth.json"
copy your nova credentials to it
{
"http-basic": {
"nova.laravel.com": {
"username": "email",
"password": "passsword"
}
}
}
composer update

Composer connection

I'm trying to make laravel project with composer with bellow cmd cod:
composer create-project laravel/laravel laravel-santcum-api
but I get error like this:
[Composer\Downloader\TransportException]
curl error 7 while downloading https://repo.packagist.org/p2/laravel/laravel.json: Failed to connect to 127.0.0.1 p
ort 1797: Connection refused
Also I'm tried with proxy and without proxy but I give the same error in both.
I found answer:
I'm in first installation of Composer added a variable named http_proxy to my environment. The value of http_proxy is what you see in that input.
All you need to do is delete that variable from the environment:
In windows Go to Enviroment Variable and remove "http_proxy" from List and reset terminal.

Deploying to Azure from Github and Token

I'm trying to deploy Laravel 5.2 to Azure from Github. I keep getting this deploy error. I'm not sure how to add the token. I created one at my github account and added it with: composer config github-oauth.github.com ". This added the auth.json with the token information, but still no luck when trying to deploy. I get the same error. What am I doing wrong?
Command: D:\home\SiteExtensions\ComposerExtension\Hooks\deploy.cmd
Install Dependencies with Composer
Loading composer repositories with package information
Installing dependencies from lock file
- Installing nesbot/carbon (1.21.0)
Downloading
Could not fetch https://api.github.com/repos/briannesbitt/Carbon/zipball/7b08ec6f75791e130012f206e3f7b0e76e18e3d7, please create a GitHub OAuth token to go over the API rate limit
Head to https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+RD00155DB2046E+2016-02-21+1233
to retrieve a token. It will be stored in "D:\home\site\repository/auth.json" for future use by Composer.
Token (hidden): No token given, aborting.
You can also add it manually later by using "composer config github-oauth.github.com <token>"
Command 'starter.cmd D:\home\SiteExt ...' was aborted due to no output nor CPU activity for 60 seconds.
You have to manually enter the command in azure web app console.
yes before command execution you have to add composer extension to your app from azure extensions.
type below command: composer config github-oauth.github.com
you can generate personal token from github seetings.
P.S let us know if you have any easy method to do so

Issue Deploying with Laravel Forge

I am trying to deploy a Laravel PHP Project with Laravel Forge. I have connected to my repository on github correctly. However, when I hit deploy, if I go to the public IP for the site, I just see:
"No input file specified."
on the page.
I do not know why it is exhibiting this behavior.
If I go to the latest deployment log, I see:
/home/forge/.forge/provision-433327.sh: line 1: cd: /home/forge/default/laravel: No such file or directory
fatal: Not a git repository (or any of the parent directories): .git
Composer could not find a composer.json file in /home/forge
To initialize a project, please create a composer.json file as described in the http://getcomposer.org/ "Getting Started" section
Could not open input file: artisan
However, I do have a composer.json file in my laravel folder....
Any ideas? Thank you in advance.
It looks like the /home/forge/default/laravel directory doesn't exist. Could you ssh in and verify that the directory exists?
These are the commands that the default forge deploy script runs:
cd /home/forge/default
git pull origin master
composer install
php artisan migrate --force
It looks like your deploy script is navigating to /home/forge/default/laravel instead.

Resources