Skip to main content

SSH

With SSH, you can access your Repl's shell remotely. SSH enables workflows like easy file transfer or using your favorite local IDE to edit your code on Replit.

SSH is available in all of our paid plans.

Configuring SSH

Open the "SSH" pane in the left sidebar. You will need an SSH Private Key to configure SSH for your Repl. For Linux or Mac, you can use the ssh-keygen tool to generate SSH keys. On Windows with PuTTY you can use PuTTYgen to generate SSH keys. Alternatively, on Windows you can install OpenSSH and use ssh-keygen and the ssh command in the Windows terminal.

You will need the "public" part of the key. On Linux this has a .pub extension.

You will also need your Repl's ID and name. You can quickly see those by running the following in your Repl's Shell tab:

echo REPL-ID is $REPL_ID
echo REPL-NAME is $REPL_SLUG
echo USERNAME is $REPL_OWNER

Public Key

Linux/Mac

Your public key is generated by ssh-keygen and has a .pub extension. For example, if you generated a key at ~/.ssh/replit, the public key will be found at ~/.ssh/replit.pub. You can display it by running:

cat ~/.ssh/replit.pub

The output of this command should be pasted into the "SSH" pane to enable the key in your Repl.

Windows

When you create a key or load an existing key into PuTTYgen, the public key to copy to Replit is displayed in the "Public key for parsing..." section:

The public key should be pasted into the "SSH" pane to enable the key in your Repl.

SSH Configuration

When configuring your SSH client, you will need to configure at least the following:

  • The SSH username is REPL-ID
  • The SSH hostname is REPL-NAME--USERNAME.repl.co
  • You will need to configure the SSH session to use your key. Password authentication is not supported.

Example: Linux/Mac, and Windows with OpenSSH

For the purposes of this documentation we'll assume that the private key file generated above is at ~/.ssh/replit. If you changed the location of the generated private key, you'll need to tweak the paths to reflect this.

Option 1: All-in-one SSH Command

In your favorite terminal application:

ssh -i ~/.ssh/replit REPL-ID@REPL-NAME--USERNAME.repl.co

Option 2: SSH Configuration File

You can add the following to your ~/.ssh/config to add a configuration for your Repl. This is the recommended way to configure SSH to your Repl if you expect to reconnect often.

Host REPL-NAME--USERNAME.repl.co
User REPL-ID
IdentityFile ~/.ssh/replit

Then, in your favorite terminal application:

ssh REPL-NAME--USERNAME.repl.co

Example: Windows (with PuTTY)

You will need to configure your PuTTY session for Replit SSH:

  1. In the "Session" category, set "Host Name (or IP address)" to REPL-NAME--USERNAME.repl.co
  2. In the "Connection > Data" category, set "Auto-login username" to REPL-ID
  3. In the "Connection > SSH > Auth" category, set "Private key file for authentication" to the path to your private key generated earlier
  4. (Optional) In the "Session" category, save your session configuration
  5. Click "Done" to open a connection to the Repl