Composer install private repository on IIS by Jenkins CI - windows

I am trying to install composer dependencies from private bitbucket repository by composer install with lines below in composer.json on my IIS server (triggered by Jenkins CI).
"repositories": [
{
"type": "vcs",
"url": "ssh://git#bitbucket.org/company/repo-name.git"
}
],
The result is:
Failed to execute git clone --mirror "ssh://git#bitbucket.org/company/web.git" "C:/Users/myusername/AppData/Local/Composer/vcs/ssh---company-bitbucket.org-repo-name.git/"
Cloning into bare repository 'C:/Users/myusername/AppData/Local/Composer/vcs/ssh---company-bitbucket.org-repo-name.git'...
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
Is it possible to link private.ppk with composer without need of ssh-agent?

Jenkins CI is logged in as sysuser, so navigate to its .ssh folder and edit config file : C:\Windows\System32\config\systemprofile.ssh\config (if "config" file not exists, create it)
Store your key to e.g. keys subfolder: C:\Windows\System32\config\systemprofile.ssh\keys\bitbucket
In config file add these lines:
Host bitbucket.org
HostName bitbucket.org
User git
IdentityFile ~/.ssh/keys/bitbucket

Related

Trouble pulling multiple repos using GH actions, deploy key only works for composer file pulling from one repo how to automate several repos?

So I am trying to build a deploy action. I want to listen for a merge to a branch on any of several repos and when the merge happens I want to:
Checkout a specific branch
set the php version
run composer update (get the most recent hashes from all repos)
run composer install (clone all the repos locally)
deploy to Acquia
I have everything working until the action tries to check out the repos, I am getting a error:
Failed to execute git clone --mirror -- 'git#github.com:organization/repo1.git' '/home/runner/.cache/composer/vcs/git-github.com-xxxxx.git/'
Cloning into bare repository '/home/runner/.cache/composer/vcs/git-github.com-xxxxx.git'...
Warning: Permanently added the ECDSA host key for IP address 'XXX.XX.XXX.X' to the list of known hosts.
git#github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
In the yaml I have:
name: composer update action
uses: kawax/composer-update-action#master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_NAME: myorganization
GIT_EMAIL: myname#myorganization.edu
COMPOSER_PACKAGES: north*
I have tried using php-composer-v6 but I get the same error. There are more than one repo so the deploy key does not seem to be the right solution.
here is an example of the repositories entries in the composer.json:
"repositories": {
"0": {
"type": "vcs",
"url": "git#github.com:organization/repo1.git",
"no-api": true
},
"1": {
"type": "vcs",
"url": "git#github.com:organization/repo2.git",
"no-api": true
},
There are many repos - nine.

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

pip and private repositories

I'm deploying a python application and I'm trying to create a pipeline with Drone.io
In my main application, I have multiple dependencies that are located in private Github repositories requirements.txt:
git+ssh://git#hostname_A/org/repo_A.git
git+ssh://git#hostname_B/org/repo_B.git
For each repository, I have a Github Deploy Key.
So my .drone.yml contains the multiple deploy keys store in drone secrets.
Inside my container, I'm copying a .ssh/config file:
Host hostname_A
HostName github.com
User git
IdentityFile /root/.ssh/repo_A_rsa
Host hostname_B
HostName github.com
User git
IdentityFile /root/.ssh/repo_B_rsa
The issue is that the repository/package repo_B also has a dependency with the private repository repo_A.
And I don't know how to link this private repository, I have tried to add install_requires and dependency_links inside the setup.py of repo_B:
setuptools.setup(
name="repo_B",
install_requires=[
"repo_A_alias # git+ssh://git#hostname_A/org/repo_A.git"
],
)
But I still get the error:
collecting repo_B # git+ssh://git#github.com/org/repo_B.git
Cloning ssh://****#github.com/org/repo_B.git to /tmp/pip-install-naymvvlo/repo_B_67066986e78c4124b8cc99242aeaa673
ERROR: Command errored out with exit status 128: git clone -q 'ssh://****#github.com/org/repo_B.git' /tmp/pip-install-naymvvlo/repo_B_67066986e78c4124b8cc99242aeaa673 Check the logs for full command output.
Or is there a way to access the log file?

composer install does not use ssh key on private repo (permission denied public key)

I have a Laravel project with some dependencies to private packages, secured through ssh, working on windows 10 with Laragon.
On composer install I get a permission denied (public key), however, if I clone the repo directly I get my regular prompt to type the ssh-key password for authentication and the clone works with no problems (using git#gitlab...., so no https).
The output looks like this:
Failed to execute git clone ...
Cloning into 'project/path/foo/bar'...
Permission denied (public key).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I already added the host (a private GitLab server) to my git config file, including the path to my ssh key, which seems to work due to git clone succeeding.
I expected that composer install would prompt for the password, but it just stops.
Any ideas how to solve this problem? I normally work on Ubuntu and didn't have such a problem before.
Edit:
Tried out the same commands with git bash (Git for windows) and it worked. But if I use Powershell or ConEmu(through Laragon) it won't work, any ideas?

Gitolite, can't clone new repo

I've just installed gitolite on my Debian server.
Then I cloned gitolite-admin repo and and new public key + following lines to conf file:
repo wallr_common
RW+ = wall
New repo was created after push.
At first I go to authorized_keys and saw that key for new user not exists, then I run ~/.gitolite/keydir$ gl-setup, and the key appears in authorized_keys.
Now I'm trying to clone it but I'm getting error:
git.exe clone --progress -v "ssh://wall#192.168.1.110:/wallr_common.git" "D:\wallr_common"
Cloning into 'D:\wallr_common'...
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
git did not exit cleanly (exit code 128) (5834 ms # 04.07.2013 0:27:46)
What can be the root cause of this?
You must use the git or gitolite account for your ssh session. Not the user account wall that you registered in gitolite.
That means ssh://git#..., instead of ssh://wall#....
Replace 'git' with the account you used to install gitolite.
See more at "How do programs like gitolite work?".
This is a similar mistake as in this question.

Resources