1

I'm trying to install some private repos via Composer in my Laravel application using deployer, I've created my github SSH alias's and added my keys with ssh-add -k path-to-key and have added them to the individual private repos, it seems that the server is still struggling to access these, my repos of my project are included as such:

"repositories": [
    {
      "type": "vcs",
      "url": "git@my-alias:company/my-package.git"
    }
]

My config for Git on my server is...

Host my-alias github.com
Hostname github.com
IdentityFile /root/.ssh/my_package_id_rsa

I have multiple hosts in there, the above is just one of 6. The error when composer install is attempted through Deployer is...

ERROR: Repository not found.

fatal: Could not read from remote repository.

Please make sure you have the correct access rights

and the repository exists.

When I run ssh -T git@github.com on the server I get:

Hi company/my-package! You've successfully authenticated, but GitHub does not provide shell access.

So I would've thought the server would be able to read my composer file and clone the repo successfully?

Ryan H
  • 2,620
  • 4
  • 37
  • 109

1 Answers1

0

If ssh -T git@github.com works on the server, it means the default ~/.ssh/id_rsa is working, not /root/.ssh/my_package_id_rsa

If you want to test access with /root/.ssh/my_package_id_rsa, you would need to type:

sudo ssh -Tv my-alias

"sudo" because otherwise /root/.ssh would not be accessible anyway.
Which means the ssh config file must be in /root/.ssh/config
And the Host entry must be my-alias. Not "my-alias github.com"

That would also means the composer install would have to be executed as root (sudo), which is not a best practice.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250