简体   繁体   中英

Connecting Visual Studio Code to a Codeanywhere container

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

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM