0

Situation:

  • I have a symfony2 project in a private github repository.
  • This project has vendor dependencies, one of which is in a different private repository. I do not own this repo, but I am a contributor and can read/write. It is added to the project using composer in the following manner:
    "repositories": [{ "type": "vcs", "url": "git@github.com:company/dependency.git" }], "require": {"company/dependency": "~1.0"}

  • I have set up PHPCI my test server, added the main project, set up a cron job, all "according to the manual".

  • I generated an SSH key on this server (in /root/.ssh), and added the key to my personal github account.
  • As root, I can clone the main project repository and the dependency repository on this test server manually.

But when running a build in PHPCI, I get the following message:

Cloning into '/var/www/phpci/PHPCI/build/10'...
Working copy created: /
RUNNING PLUGIN: composer

Using --prefer-source flag
Loading composer repositories with package information
Failed to clone the git@github.com:company/dependency.git repository, 
try running in interactive mode so that you can enter your GitHub credentials

[RuntimeException]

Failed to execute git clone --mirror 'git@github.com:company/dependency.git' '/root/.composer/cache/vcs/git-github.com-company-dependency.git/'

So the vendor dependency can't be retrieved due to authentication problems. But the main project, also in a private repository, is being cloned without any problems by PHPCI.

The cronjob and composer are running as root, the /var/www/phpci/PHPCI/build folder is filled with builds owned by root. So why does it successfully clone the project, but not the dependency?

What would be the best way to fix this?

okdewit
  • 2,406
  • 1
  • 27
  • 32

1 Answers1

0

Nevermind, as happens so often, by writing this question I stumbled onto the answer myself.

To shorten the search for future readers:

I had to do cd /var/www/phpci/PHPCI/build/<number> (I picked my last attempt, build 10), and manually run sudo composer install in there. This fails as well, but it gives you a link to the github page where you can generate an AUTH Token and waits for you to paste it back in. The auth token is stored in /root/.composer, so you only have to do this manually once.

okdewit
  • 2,406
  • 1
  • 27
  • 32