Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run composer update with private packages #225

Closed
springerin opened this issue Sep 4, 2020 · 3 comments
Closed

Run composer update with private packages #225

springerin opened this issue Sep 4, 2020 · 3 comments

Comments

@springerin
Copy link

Hi, David.

I wasn't sure how to contribute to the documentation so I create an issue with the problem and solution I've found that might not be obvious hoping it helps others. Feel free to close the issue if it wasn't the right thing to do. Thank you

Prerequisities:

warden version 0.9.0
Docker version 19.03.12, build 48a66213fe
docker-compose version 1.25.0, build unknown
ubuntu 20.04
Composer requesting access to private repository to which you have access through ssh key.

Steps to reproduce error:

Run composer update

Result:

Gathering patches for root package.
Loading composer repositories with package information
The authenticity of host 'bitbucket.org ' can't be established.
RSA key fingerprint is ......
RSA key fingerprint is .......
Are you sure you want to continue connecting (yes/no)? yes

[RuntimeException]
Failed to execute git clone --mirror 'git@bitbucket.org:xyz/xyz.git' '/home/www-data/.composer/cache/vcs/gxyz.git/'

Cloning into bare repository '/home/www-data/.composer/cache/vcs/git-bitbucket.org-xyz.git'...
Warning: Permanently added 'bitbucket.org' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Solution:
Create ( or modifiy if already present) the file .warden/warden-env.yml and add the following content ( with the specifics of your own file naming and path for ssh key):

version: "3.5"
services:
  php-fpm:
    volumes:
      - ~/.ssh/known_hosts:/home/www-data/.ssh/known_hosts:ro
      - ~/.ssh/id_rsa:/home/www-data/.ssh/id_rsa:ro
      - ~/.ssh/id_rsa.pub:/home/www-data/.ssh/id_rsa.pub:ro
@sebastian-ehrling
Copy link
Contributor

Hey @springerin
this works. Thank you! You can create a Pull Request do add this to the core.

@davidalger
Copy link
Collaborator

davidalger commented Sep 8, 2020

@springerin Thanks for the note, and I'm glad you found an operable workaround for your use-case.

This should be taken care of already in the form of SSH agent forwarding (on macOS it requires a new enough version of Docker Desktop; linux, as you're running, it's simpler since there's no virtual machine involved). The requirement there of course is that you have a running ssh agent when you start the project environment, and the agent should already contain your identity when you enter warden shell and try to connect.

There is more info on this here: #121

@springerin
Copy link
Author

Thank you, I wasn't aware of this feature.

In my case I need to do first
ssh-add /home/vvvv/.ssh/id_rsa
and restart to make it work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants