I'm using Mac and Docker for my local PHP/Nginx environment.
I decided to add my own private repository to composer.json. It looks something like this:
"repositories":[
{
"type": "vcs",
"url": "ssh://git@privaterepo.com/my-repo/php-code-fixer.git"
}
]
I tried to execute following command: docker exec -it mysite_php_1 php /usr/local/bin/composer.phar require --dev my-repo/php-code-fixer
I get this error:
[RuntimeException]
Failed to execute git clone --mirror 'ssh://git@privaterepo.com/my-repo/php-code-fixer.git'
'/root/.composer/cache/vcs/ssh---ssh://git@privaterepo.com/my-repo/php-code-fixer.git/'
Cloning into bare repository '/root/.composer/cache/vcs/ssh---ssh://git@privaterepo.com/my-repo/php-code-fixer.git'...
git@privaterepo.com: 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 tried to clone the repo via ssh without docker and it works. I have permission.
I tried to solve above problem by mounting my .ssh folder to docker container like this:
php:
volumes:
- ~/.ssh:/root/.ssh
but then I get
[RuntimeException]
Failed to execute git clone --mirror 'ssh://git@privaterepo.com/my-repo/php-code-fixer.git'
'/root/.composer/cache/vcs/ssh---ssh://git@privaterepo.com/my-repo/php-code-fixer.git/'
Cloning into bare repository '/root/.composer/cache/vcs/ssh---my ssh repo'...
/root/.ssh/config: line 8: Bad configuration option: usekeychain
/root/.ssh/config: terminating, 1 bad configuration options
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
How do I install my private repository using Composer from Docker? I cannot execute composer outside of docker because my machine doesn't have Memcached installed (the docker environment does) and because of that I'm getting Class 'Memcached' not found
.
I could install Memcached but then everyone who wants to use my script needs to have Memcached installed.