Isn’t it a nightmare to switch from your P.C. to your laptop and you don’t have any of the Visual Studio Extension snippets and settings. If you want to know how to sync your visual studio across multiple devices in this article you will learn how to do that.
So the best way that I have found to sync your visual studio code is this extension here. Settings sync:
https://marketplace.visualstudio.com/items?itemName=Shan.code-settings-sync
The first thing that you need to do is to install the extension on your VSCode.
Now this extension is using GitHub, where it uploads y our settings to a gist and after that you use the gist to sync your settings to other devices.
Now to start uploading our settings, just press SHIFT + ALT + U for upload, and Visual Studio should open your GitHub page.
There you can create personal access tokens.
If you’re not logged in, make sure you do that. So you would want to click on the “Generate New Tokens” here, on top of it and should ask you to type your password again.
After you are in, you would want to give your access token description or a name basically. I will give mine the description VSCode Sync Tutorial and after that go ahead and scroll down to where the guest check-box is and check it.
Now let’s click on generate token. This will generate a token for us that we will need to use in VSCode.
Please save this somewhere as we would need it on the other machines as well. Now open back the Visual Studio Code and it should be asking you now for your GitHub token. Go ahead and paste it there and click ENTER. Now you can upload your settings by either pressing SHIFT + ALT + U or if you forget the keyboard shortcut for any reason whatsoever, you can also trigger the plot by pressing F1 and searching for “sync”.
There you should be able to find the command “Sync Update/Upload Settings”. I also want to show you how you can update your token or find it in case you forget it. Search again for “sync” and now click on Advanced Settings. On top you will see ” Edit Extension Local Settings”. C lick on that and you’ll be opening the Sync Local Settings JSON file, and let’s first format it, so we can read it better, by pressing SHIFT + ALT + F.
Now, here you can see our GitHub token. You can change it from here or recover it in case you forget it. Now in order to simulate a new system, let’s reset the extension settings and delete all of our saved extensions and restart this VSCode. O pen the Visual Studio Code again and go ahead and install only the settings sync extension.
After you install it, l et’s download our settings by pressing SHIFT + ALT + D. I t will ask us for our GitHub token again, t hat I told you to save somewhere. So paste that there. Now it will also ask those for GistID that sync settings has created. S o in order to find that, go to your GitHub and open your Gists, and find the one that was last created by the settings sync. Now open this and in the browser address, after your name and the forward slash, t his would be the ID of your Gist.
Copy this and paste it in the extensions. Now you can freely sync your settings. One other cool thing that you can do this with this extension is that you can share your settings in a public Gist and everyone will be able to sync with them.
For example if a colleague of yours likes your settings, you can give him the gist and he will be able to download it. You can also do this if you don’t want to use tokens when syncing, but if you do that, remember to share your settings to a public guest by using this option.
If you have enjoyed this article hit the Like button below and share it. Also don’t forget to subscribe to the CodingSRC Youtube Channel so you don’t miss anything.
See you next time.