Sync Visual Studio Code Between Computers
I have Visual Studio Code setup on both my personal and work computers. Often I download an extension or made a config change on one copy then had to remember to do the same on the other installs. Not ideal. However these is a way to sync all of the settings including installed extensions between copies using an extension. Here is how you do it.
The extension in question is called Settings Sync which can be downloaded from the Marketplace or directly in VS Code as normal. From the website the key features are:
- Use your GitHub account token and Gist.
- Can create Anonymous Gist without using your GitHub account token.
- Easy to Upload and Download on one click.
- Show a summary page at the end with details about config and extensions effected.
- Auto Download Latest Settings on Startup.
- Auto upload Settings on file change.
- Share the Gist with other users and let them download your settings.
- Supports GitHub Enterprise
It syncs:
- Settings File
- Keybinding File
- Launch File
- Snippets Folder
- VSCode Extensions Settings
- Workspaces
It is pretty easy to setup. The extension uses a GitHub Gist and Key to store your settings on GitHub and each copy syncs to and from that.
Setup the key
In Github go to Settings…Personal Access Tokens…Generate New Token
Give the Token a description and then make sure under Select scopes check gist. Click Generate token
This will then generate a token. Make sure you copy this code as you will never see it again.
Upload initial settings
Once the extension is installed press F1 to open the Command Palette. Type in Sync and select the option Sync : Update / Upload Settings:
Enter the Token generated above:
The extension will then upload all your settings to a Gist. This Gist is secret, only accessible to you. The Gist ID needs to be copied to download the settings on another computer. Take a note of it:
You can view this Gist and the settings uploaded by going to https://gist.github.com/{github_username}//{gist id}:
Download settings on another computer
Once the extension is installed on the computer, press F1 to open the Command Palette. Type in Sync and select the option Sync : Download Settings:
Enter the Gist Id:
Once the download is completed a sync summary is displayed:
Summary page
By default the summary page is displayed after a sync. This can be turned off by pressing F1 to open the Command Palette. Type Sync and select the option Sync: Advanced Options:
Then in the Advanced options select Sync : Toggle Show Summary Page On Upload / Download:
Automatically sync settings
When a change is made to you settings by default you need to manually upload and download. You can change an advanced option to enable upload and download automatically when settings are changed. This can be turned on by pressing F1 to open the Command Palette. Type Sync and select the option Sync: Advanced Options:
Then in the Advanced options select Sync : Toggle Auto-Upload On Settings Change:
Once enabled you get a confirmation:
Then you need to enable Auto Download. This can be turned on by pressing F1 to open the Command Palette. Type Sync and select the option Sync: Advanced Options as above. Then select Sync : Toggle Auto-Download On Startup:
That’s it. The copy of VS Code will automatically sync with the settings Gist. Just do this on all your copies of VS Code.
Wrap Up
There are plenty of other options available with this extension. See the GitHub Page from Shan which explains everything. I highly recommend you use the extension if you are using multiple computers.