After Laravel Forge setup, "Permission denied (publickey)"

Posted May 21, 2014 37.2k views
Yesterday I created a Digital Ocean account and connected with Laravel Forge. I generated a new droplet via Forge. After it's created, I try to log in using keys. I keep getting an "Permission denied (publickey)" error. I tried deleting the contents of my known_hosts file. After attempting to connect I got the untrusted server message and opted in. The new key was written to my known_hosts. And then the same error appeared. Any ideas or tests I can run to see what's happening?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
9 answers

I hit this problem as well. Here's the solution (assuming you've already correctly added your public key to the Forge UI)...

In the welcome email it says your username is "forge". So use this on the command line, and replace with your server's IP:

ssh forge@

Hope that helps.
No idea. Ask Laravel Forge support. That or learn to setup a LEMP stack yourself.
Hi Rich,

Did you configure an SSH key in Laravel Forge?
To Alex: been there, done that, moved on to Laravel Homestead and Forge on Vagrant, because it's nifty. Thanks anyway.

To Andrew... I actually did follow the instructions... and have cycled and recycled through various things I found on stackoverflow et al. Now it's in DO Support's court.

FYI, in case anyone else has problems, the deployment from Forge seems to disable password access, so the keys are necessary, and so server-side fiddling isn't possible. I must admit I'm no expert at this keygen stuff, but followed instructions to the letter, pretty sure.

Thanks... I'll try to get back here with the resolution.
Rich, I encountered the same issue.

Turns out I was copied the key incorrectly, I tried it again, by doing the pbcopy to the clipboard and inserting it in the forge admin panel and all worked 100%.

Seems a straight copy paste on my mac screwed something up.
Thanks @andy and @dylan forge@ip_address cured my problems but I also believe I had the copy issue as well.


Same here. Doesnt matter how do i try to do it, simply not working. Could this be doe to the new API (forge uses v1.0)?

I have same problem . I need help .

  • Hi shopping.
    I had the same problem, but I found the solution deleting the prior ssh key from laravel forge, and re-copying the id_rsa (from your computer) with this command:

    $ pbcopy < ~/.ssh/

    Then… all work fine

For those whom tried using the pbcopy on the GitBash command and did not work try:
$ clip < ~/.ssh/ It will basically copies your SSH Key to a clipboard, paste it to your Forge Dashboard. Once that is done, try to log in using ssh name@your-ip -i ~/.ssh/

***Can someone tell me how can I login to my database now? Should I use Digital Ocean at all anymore?