Skip to content

Instantly share code, notes, and snippets.

@vkeenan
Last active May 17, 2024 19:38
Show Gist options
  • Save vkeenan/3ba114d92044fa0c38c35e2ed354fde7 to your computer and use it in GitHub Desktop.
Save vkeenan/3ba114d92044fa0c38c35e2ed354fde7 to your computer and use it in GitHub Desktop.
How To Power Up SFDX-CLI with VS Code Remote - SSH, Windows Edition
by Vernon Keenan
from SalesforceDevops.net
Youtube: https://youtu.be/vdwM2WOUBuk
Change these values for your environment:
devops = DNS hostname of remote SSH server
vern = Linux username on remote server
1. Install Fira Code Retina
a. Fira Code Retina GitHub
b. Download from github
c. Extract with zip
d. Install with double-click
2. Configure VS Code Terminal
Settings-> search terminal font
Fira Code Retina
3. Log onto devops with sudo account
PS> ssh sysmaint@devops
4. Install java
$ sudo apt install default-jre
$ java -version
$ which java
5. Setup nonprivileged user
$ sudo apt install zsh -y
$ sudo adduser vern
$ chsh -s $(which zsh) vern
$ logout
PS> ssh vern@devops
#
# when logging into zsh for the first time, select option 2
#
$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
$ exit
$ logout
PS> ssh vern@devops
$ sed -i 's/robbyrussell/agnoster/' ~/.zshrc
$ sed -i 's/plugins=(git)/plugins=(git salesforce-cli-zsh-completion)/' ~/.zshrc
$ git clone https://github.com/wadewegner/salesforce-cli-zsh-completion ~/.oh-my-zsh/custom/plugins/salesforce-cli-zsh-completion
$ source ~/.zshrc
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | zsh
#
# hit q to quit the vim editor that may become displayed
#
$ source ~/.zshrc
$ nvm install --lts
$ npm install sfdx-cli -g
$ sfdx
6. Copy SSH Key
$ mkdir .ssh
$ touch .ssh/authorized_keys
$ logout
# Change "vern" and "devops" to your user and host
PS> type C:\Users\vern\.ssh\id_rsa.pub | ssh vern@devops 'cat >> .ssh/authorized_keys'
$ ssh vern@devops
$ exit
7. Setup VS Code for Remote Salesforce Development
a. Install VS Code Extensions
• Salesforce Extension Pack
• Visual Studio Code Remote - SSH
b. Run VS Code Command (F1)
• Install Local Extension in 'Remote'
8. Create first project
$ sfdx force:project:create --projectname=mybranch --manifest
$ cd mybranch
$ sfdx auth:device:login --setdefaultusername --setalias myUser
$ sfdx force:source:retrieve --manifest=manifest/package.xml
9. Open VS Code in new directory
a. CTRL-~ opens a terminal window on remote server
b. $ sfdx force:org:list
10. Enable VS Code Settings Sync
a. Run VS Code Command (F1)
• Settings Sync: Turn On
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment