Skip to content

SFTP Connection

Codeanywhere provides an option to connect to your Workspace using the Secure File Transfer Protocol (SFTP). The SFTP tool allows you to transfer files between your local machine and your Workspace, providing a secure and efficient way to manage your project files.

It uses the SFTP sync extension to enable adding, editing, or deleting files within a local directory and have it sync to a remote server directory using different transfer protocols like FTP or SSH.

Prerequisites

Before using the SFTP tool, ensure you have the following:

  • A Codeanywhere account.
  • A Workspace created in Codeanywhere.
  • The SFTP sync extension installed in your Workspace.

Installation

  1. Select the Extensions tab.
  2. Install the SFTP sync extension from the marketplace.

Usage

  • Add an FTP Connection
  1. Open the Extensions tab and select the SFTP sync extension.
  2. Open a local directory you want to sync to the remote server.
  3. Click CMD/CTRL + SHIFT + P to open command palette, and run the SFTP: config command.
  4. Configure the connection using the SFTP configuration file. The configuration files specifies the connection details, including the host, username, password, and the paths for local and remote environment.
  • Configuration Setup
  1. In the sftp.json configuration file, configure the following fields:

    name: A string to identify your server connection.

    context: The path within your project to use for the SFTP connection.

    host: The hostname of your server.

    username: Your server username.

    password: Your server password.

    remotePath: The directory on the server where the files should be synced.

Example sftp.json configuration:

[
{
"name": "eu-central-1.sftpcloud.io",
"context": "project/build",
"host": "eu-central-1.sftpcloud.io",
"username": "username",
"password": "password",
"remotePath": ""
},
{
"name": "server2",
"context": "project/src",
"host": "eu-central-1.sftpcloud.io",
"username": "username",
"password": "password",
"remotePath": ""
}
]
  1. Save the sftp.json configuration file and copy it to a safe location to avoid losing the connection details.

  2. Start working with the SFTP connection.

Use the commands provided by the SFTP extension to upload, download, or delete files between your local and remote directories.