Nov 10, 2018

Connect to a Laravel Forge server from your Mac using SSH

To access your Forge server through an SSH connection follow these steps:

1. Create your RSA keys:

ssh-keygen -t rsa

By default, this will place a private and public key in a .ssh folder in your Home directory. It won't be encrypted by a passcode so anyone with access could steal your private key.

2. Get a copy of your public key:

Use this terminal command to copy the key for you (opening the key in a text editor causes some errors with copy/paste for me).

pbcopy < ~/.ssh/id_rsa.pub

3. Upload your public key using Forge:

Go to your server in Forge and find the section called SSH Keys. Name your machine and paste the public key in the text area. The name of your machine can't have spaces in it (or most special characters), so double check your name if you get that error. The error message Forge provides makes it look like the problem is with your key not the name.

4. Connect to your server:

In your terminal enter:

ssh forge@YOUR_SERVER_IP_OR_DOMAIN_NAME

You'll have to add the connection to your known hosts and you should be good to go!


Please Login or Register to Comment