Install VSCODE (Visual Studio Code) Sync-Rsync on Windows 10 Using WSL (Windows Subsystem for Linux)

Edited by Doug Collins, Patrick Murphy, Maria Quinney, Nathan eddings


First I tried using the vscode "Remote Workspace" extension but it has a fatal flaw. You cannot search local files!! I was working on a Laravel Framework based app and it was a nightmare to find what I was looking for sometimes without the ability to search through all the files for what I was looking for. (Yes I lose track sometimes... getting too old).

Next I was synchronizing between windows 10 and my Linux dev test environment using the SFTP extension but it kept missing files and making mistakes. I knew that rsync was completely reliable so I found an extension to do that but the setup WAS NOT STRAIGHT FORWARD at least for me. So I decided to document what I did for others ( YOU! ). I hope this helps.

First you will need to make sure you have Rsync installed on both Windows 10 and Linux.

Install Rsync on Linux

This is easy. If you are using a different Linux distro you will need to adapt.

  1. 1
    Type "rsync" on your command line and see if it is already installed
    Was this step helpful? Yes | No| I need help
  2. 2
    If not, type either "yum install rsync" for Centos or "sudo apt-get install rsync" for Ubuntu.
    Was this step helpful? Yes | No| I need help

Install Rsync on Windows 10 by Enabling WSL (Windows Subsystem for Linux)

If you haven't heard of WSL or used it you are in for a real treat! It opens a whole new world running in my base Unbuntu on my windows 10 laptop. I can run and code all kinds of things that were quite frankly very hard or messy before. Its not hard to install.

Instead of writing out the instructions again I will refer you to these instructions for setting up WSL, BUT STOP WHEN IT ASKS YOU TO INSTALL ANACONDA. You won't need that for this application.

Add a SSH Key so no login is needed to ssh from your windows computer to the Linux dev environment

At your windows command prompt (NOT the newly installed bash prompt) do the following:

doug@DESKTOP-4Q824TC:~$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/doug/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/doug/.ssh/id_rsa.
Your public key has been saved in /home/doug/.ssh/
The key fingerprint is:
SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx doug@DESKTOP-4Q824TC
The key's randomart image is:
+---[RSA 2048]----+
|    =.           |
|  o=.+           |
| ++.* . .        |
| *+X.. +         |
|BoO.= . S        |
|*% = o + .       |
|# = . o +        |
|.= .   E .       |
|                 |

doug@DESKTOP-4Q824TC:~$ ssh-copy-id -i ~/.ssh/id_rsa
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/doug/.ssh/"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys's password:

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh ''"
and check to make sure that only the key(s) you wanted were added.

SHAMELESS PLUG: Yes my new project is an amazing new concept to destroy Bias. Have you ever wanted to quickly be able to correct something you read on the web. Now you can !!

Install the VSCODE sync-rsync extension

  1. 1
    Was this step helpful? Yes | No| I need help
  2. 2
    Type sync-rsync
    Was this step helpful? Yes | No| I need help
  3. 3
    Go ahead and click on it and choose "Install"
    Was this step helpful? Yes | No| I need help

Configure sync-rsync

The extension comes with instructions but they were confusing and I ran into several problems. So I am going to share my config with you.

  1. 1
    Create a local folder where your local copy of the code will live
    i.e.. your dev folder.
    Was this step helpful? Yes | No| I need help
  2. 2
    Create a new folder ".vscode"
    Was this step helpful? Yes | No| I need help
  3. 3
    Inside .vscode folder create a files called "settings.json"
    Was this step helpful? Yes | No| I need help
  4. 4
    Cut and =Paste this json into it and make sure you SAVE.
        "": "ssh -p 22",
        "sync-rsync.remote": "",
        "sync-rsync.local": "/mnt/c/Users/cave7/Documents/TruifyDev1Rsync",
        "sync-rsync.onSave": true,
        "sync-rsync.onSaveIndividual": true,
        "sync-rsync.executableShell": "C:\Windows\System32\bash.exe",
        "sync-rsync.exclude": [
        "sync-rsync.chmod": "D2775,F664",
        "sync-rsync.useWSL": true
    Was this step helpful? Yes | No| I need help
  5. 5
    Now you should be able to sync and the files should show up
    To do this press CTRL-SHIFT-P and type in "sync-rsync" and choose the "Sync Remote to Local" option. If your above config file is working all the remote files should show up. If they don't you likely messed up something like a path above. An error message should show up in the output window. Check and see what went wrong.
    Was this step helpful? Yes | No| I need help
  6. 6
    With this config every time you save, it will upload any changes, so you should never need to Sync from local to remote
    However you may need to the reverse if a file is changed on the remote server since there is no way for vscode or the sync-rsync extension to know about that. So just trigger the Remote to Local sync as per the instructions in the previous step.
    Was this step helpful? Yes | No| I need help

You need the chmod option because windows and Linux don't use the same permissions. This option tells rsync to use 755 for directories and 664 for regular files. Without this git kept seeing every file as modified due to its file permission change. This solved that problem for me.

If you have problems with any of the steps in this article, please ask a question for more help, or post in the comments section below.


Article Info

Categories : Windows

Recent edits by: Maria Quinney, Patrick Murphy, Doug Collins

Share this Article:

Thanks to all authors for creating a page that has been read 352 times.