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:

  1. Use your GitHub account token and Gist.
  2. Can create Anonymous Gist without using your GitHub account token.
  3. Easy to Upload and Download on one click.
  4. Show a summary page at the end with details about config and extensions effected.
  5. Auto Download Latest Settings on Startup.
  6. Auto upload Settings on file change.
  7. Share the Gist with other users and let them download your settings.
  8. Supports GitHub Enterprise

It syncs:

  1. Settings File
  2. Keybinding File
  3. Launch File
  4. Snippets Folder
  5. VSCode Extensions Settings
  6. 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

Generate Token

Give the Token a description and then make sure under Select scopes check gist. Click Generate token

Generate Token

This will then generate a token. Make sure you copy this code as you will never see it again.

Token

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:

Sync Setup

Enter the Token generated above:

Sync Setup

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:

Sync Setup

You can view this Gist and the settings uploaded by going to https://gist.github.com/{github_username}//{gist id}:

Sync Setup

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:

Sync Setup

Enter the Gist Id:

Sync Setup

Once the download is completed a sync summary is displayed:

Sync Setup

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:

Sync Setup

Then in the Advanced options select Sync : Toggle Show Summary Page On Upload / Download:

Sync Setup

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:

Sync Setup

Then in the Advanced options select Sync : Toggle Auto-Upload On Settings Change:

Sync Setup

Once enabled you get a confirmation:

Sync Setup

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:

Sync Setup

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.

Categories:

Updated: