Skip to main content
Version: Weekly Build

Connect to Your Workspace via SSH

This guide will walk you through setting up Secure Shell (SSH) access for your workspaces. This allows you to securely connect to and interact with your development environment directly from your local terminal.

Key Management

We are currently rolling this feature out in phases. Managing your authorized SSH keys is currently handled exclusively via our Public API. However, retrieving your workspace connection string is fully supported within the Workspace dashboard.

Prerequisites

Before attempting to connect, ensure you have completed the following:

  • An SSH Key Pair generated on your local machine. If you need to generate one, open your local terminal and run:
    ssh-keygen -t ed25519 -C "[email protected]"
  • A valid Public API Token to authenticate your key management requests. See Public API documentation for details.

Add Your SSH Key (Public API)

Register a New Public Key

Send a POST request to upload your public key. Replace <YOUR_API_TOKEN> with your actual authentication token and paste your public key string into the publicKey field.

  • Endpoint: POST https://<YOUR_DOMAIN>/api/ssh/keys
  • Headers:
    • Authorization: Bearer <YOUR_API_TOKEN>
    • Content-Type: application/json
curl -X POST https://dev-codesphere.com/api/ssh/keys \
-H "Authorization: Bearer <YOUR API TOKEN>" \
-H "Content-Type: application/json" \
-d '{ "publicKey": "<YOUR PUBLIC KEY>" }'

View Your Registered Keys

To see a list of all public keys currently authorized to access your workspaces, send a GET request:

curl -X GET https://dev-codesphere.com/api/ssh/keys \
-H "Authorization: Bearer <YOUR_API_TOKEN>"

Remove an SSH Key

If you need to revoke access for a specific key, issue a DELETE request:

curl -X DELETE https://dev-codesphere.com/api/ssh/keys \
-H "Authorization: Bearer <YOUR API TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"publicKeyFingerprint": "<YOUR PUBLIC KEY FINGERPRINT>"
}'

Connect to Your Workspace

Once your public key is registered, you can find your workspace's connection string directly in the platform.

  1. Open your active workspace.
  2. Click the editor dropdown in the top-right toolbar.
  3. Select Connect via SSH.
  4. Copy the connection string from the modal and paste it into your local terminal.

Connect via SSH menu option Copying the connection string from the Workspace.

Example command:

ssh -J <your_local_domain> user@<workspaceId>

Connect from a Local IDE

Refer to your IDE's official documentation for SSH remote development setup: