3

I use Codeanywhere. The cloud IDE is okay but I'd rather use Visual Studio Code. Since I'm on a work computer without admin rights, I have a portable version of Visual Studio Code that I'd like to use to connect to my CodeAnywhere container. I found a couple of extensions that let you mount a folder through ssh. They are SSH FS and FS Remote. But I can't figure out how to actually connect. Anyone have any experience with this? Or know any alternatives to hosting a container remotely and connect with VSC code? Thanks

False Dragon
  • 167
  • 1
  • 8
  • From time to time I use the [SSH FS](https://marketplace.visualstudio.com/items?itemName=Kelvin.vscode-sshfs) extension, but only to access and modify some files on a few servers. I'm not sure if you're able to use it to connect to your container since this extension just mounts a remote folder over SSH as a local workspace folder. – Joey Mar 12 '19 at 02:23

1 Answers1

3

The following are instructions from a Mac.

Setting up SSH keys

  1. Open a terminal.
  2. Run the command to generate the SSH keys: ssh-keygen -t rsa
  3. Hit enter to accept the default location to save the key.
  4. Hit enter twice when prompted for entering passphrase.
  5. Copy the public key: pbcopy < ~/.ssh/id_rsa.pub
  6. Open an SSH session on your Codeanywhere container.
  7. Paste your copied public key to the file ~/.ssh/authorized_keys on the container.

Gather Container Information

  1. Right-click the container and select Info.
  2. You'll get an information page specifically for your container such as host and port.

Setting up Visual Studio Code

  1. Install Remote - SSH extension by Microsoft for Visual Studio Code.
  2. Click on the button at the left bottom corner of VSC, which will open the command palette with a list of Remote-SSH options.
  3. Select Open Configuration File...
  4. Select the ssh config file to edit, example /Users/username/.ssh/config
  5. Add the following, but fill in the info for your container:
Host Codeanywhere
    HostName hostXX.codeanyhost.com
    User cabox
    Port 12345
    IdentityFile ~/.ssh/id_rsa
  1. Save and exit the config file.
  2. Again, open the command palette for Remote-SSH and select Connect to Host.