Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

kristina.odziomkova's avatar

Laravel Sail + SSH keys / private packages?

Hi, I am using Sail and to install my dependencies I use command sail composer install. However in my composer.json I also have one private package and it throws permission denied error.

 [email protected]: Permission denied (publickey).                                                                                                                                                
 fatal: Could not read from remote repository. 

I have access to that package's repository and also an SSH key in Bitbucket (it does not have the default name id_rsa but a different one, because I have multiple Bitbucket accounts and each one needs unique SSH key). In my /.ssh/config the correct SSH key is set.

We used to have our own "Sail" before Sail was created and there we had a special directory where we could put our SSH keys. But I didn't find anything about SSH keys in Sail's documentation or GitHub issues.

0 likes
3 replies
kristina.odziomkova's avatar

@msslgomez I do not know if there is a simpler way, but this is how I do it now:

  1. copy private ssh keys to project folder into .ssh folder
  2. sail shell
  3. sail@c6d28cd21a6e:/var/www/html$ cp .ssh/id_rsa ~/.ssh/
  4. eval `ssh-agent`
  5. ssh-add .ssh/id_rsa
  6. check with: ssh-add -l
  7. composer install

Please or to participate in this conversation.