You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Remote - SSH extension is absolutely awesome and really convenient ! Thanks a lot for that !
I like to have my code store locally and use GitHub Desktop to manage the GIT versioning.
It would be awesome if the Remote - SSH extension could give the ability to sync a local folder to a remote folder !
It's maybe out of the scope of the extension though ; and I'll try the GitHub functionalities inside VS Code :)
Erich Gamma (@egamma)Kai Maetzel (@kieferrm) Yeah rsync would work fine for this scenario. macOS / Linux it is built in. For Windows there are a number of clients. The extension seems to support using cygwin or wsl to get the job done.
The extension does not sync .git, which if you are using a local git client is actually probably a good thing. It also excludes the .vscode folder, which is not ideal for this scenario, but you can override this.
However, the "onSave" and watch functionality is geared towards pushing to the remote, not pulling from it. So you need to run Sync-Rsync: Sync Remote to Local manually each time you want to get the remote contents on your machine. For our use case, you'd want on save to pull from the remote, but clearly this use case didn't exist prior to the Remote-SSH extension.
I was able to get it working using a workspace settings.json file like this:
Rather than recommending this extension given it's current state, we documented how to use SSHFS and rsync to achieve this kind of thing from the command line for now.
I am after this feature as well. I currently use this script,
#!/bin/sh
USER="remote_user_here"
SERVER="remote_server_here"
LOCAL_DIR="/local/dir/here/"
REMOTE_DIR="/remote/dir/here/"
PEM_LOCATION="/path/to/local/key.pem"
# Open VSCode with your files.
code $LOCAL_DIR
# Start fswatch, wait for changes in your local dir and then execute rsync.
# NOTE: Syncs remotely as apache user.
fswatch -o $LOCAL_DIR | xargs -n1 -I{} rsync -avzh -e "ssh -i $PEM_LOCATION" \
--include=".htaccess" \
--exclude=".*" \
--exclude=".*/" \
--exclude="*.orig" \
--rsync-path="sudo -Hu apache rsync" $LOCAL_DIR $USER@$SERVER:$REMOTE_DIR
which is great. But trying to deploy this to other team members is a pain. Partly this pain is because my script is setup for my macOS machine with my servers. I didn't create a process doc on how to setup this script and install required programs for macOS. I have 0 idea how this script would be setup on Windows (I assume it probably works out of the box for Linux). Being sure devs have code in the system path. Etc etc.
I had used sync-rsync before but there was a few things I didn't like about it. Having to open VSCode, open workspace, open commands thing, start remote sync*. Compared to my scripts solution of open terminal and execute ./site1_dev.sh.
*I think I also had an issue where it wasn't watching the entire folder for changes so you'd have to manually sync after a git pull. Possibly a bug, possibly fixed.
I'll be sure to have a try of this extension again and report back.
This issue is being closed to keep the number of issues in our inbox on a manageable level, we are closing issues that are not going to be addressed in the foreseeable future: We look at the number of votes the issue has received and the number of duplicate issues filed. More details here. If you disagree and feel that this issue is crucial: We are happy to listen and to reconsider.
Are there any plans to indeed include this out of the box?
Or are there ways to deploy files to the remote machine conveniently (inside vscode) on a file save without using the sync-rsync extension?
Activity
taiya commentedon May 13, 2019
What's wrong with rsync? You can just create an action that executes the desired sync operation.
jbelien commentedon May 13, 2019
Oh well ... indeed ! I guess it could work just fine 😂
Thanks for the suggestion !
taiya commentedon May 13, 2019
And on that note, there seem to be some extensions available:
https://marketplace.visualstudio.com/items?itemName=vscode-ext.sync-rsync
Let me know if you try it out, and how well it works
(otherwise you might want to "close" the issue)
egamma commentedon May 13, 2019
//fyi Chuck Lantz (@Chuxel) Kai Maetzel (@kieferrm) didn't know about this extension, suggest to try it and see whether we can recommend it for synching?
Chuxel commentedon May 13, 2019
Erich Gamma (@egamma) Kai Maetzel (@kieferrm) Yeah rsync would work fine for this scenario. macOS / Linux it is built in. For Windows there are a number of clients. The extension seems to support using cygwin or wsl to get the job done.
The extension does not sync
.git, which if you are using a local git client is actually probably a good thing. It also excludes the.vscodefolder, which is not ideal for this scenario, but you can override this.However, the "onSave" and watch functionality is geared towards pushing to the remote, not pulling from it. So you need to run Sync-Rsync: Sync Remote to Local manually each time you want to get the remote contents on your machine. For our use case, you'd want on save to pull from the remote, but clearly this use case didn't exist prior to the Remote-SSH extension.
I was able to get it working using a workspace
settings.jsonfile like this:{ "remote.extensionKind": { "vscode-ext.sync-rsync": "ui" }, "sync-rsync.local": "/Users/chuck/Developer/projects/rsync-test/remote-containers-test", "sync-rsync.remote": "[email protected]:/home/parallels/Repos/remote-containers-test", "sync-rsync.delete": true, "sync-rsync.include": ".vscode", "sync-rsync.args": ["--rsh=ssh"] }In terms of recommending it, the extension has no icon but was updated April 3rd, so it's being maintained.
Add information on using SSHFS, rsync with SSH hosts
Chuxel commentedon May 16, 2019
Rather than recommending this extension given it's current state, we documented how to use SSHFS and rsync to achieve this kind of thing from the command line for now.
https://code.visualstudio.com/docs/remote/troubleshooting#_using-sshfs-to-access-files-on-your-remote-host
https://code.visualstudio.com/docs/remote/troubleshooting#_using-rsync-to-maintain-a-local-copy-of-your-source-code
beeradmoore commentedon Jun 1, 2019
I am after this feature as well. I currently use this script,
which is great. But trying to deploy this to other team members is a pain. Partly this pain is because my script is setup for my macOS machine with my servers. I didn't create a process doc on how to setup this script and install required programs for macOS. I have 0 idea how this script would be setup on Windows (I assume it probably works out of the box for Linux). Being sure devs have code in the system path. Etc etc.
I had used sync-rsync before but there was a few things I didn't like about it. Having to open VSCode, open workspace, open commands thing, start remote sync*. Compared to my scripts solution of open terminal and execute ./site1_dev.sh.
*I think I also had an issue where it wasn't watching the entire folder for changes so you'd have to manually sync after a git pull. Possibly a bug, possibly fixed.
I'll be sure to have a try of this extension again and report back.
EDIT: I also just found this extension which seems promising. https://marketplace.visualstudio.com/items?itemName=liximomo.sftp
vscodebot commentedon Oct 16, 2019
This issue is being closed to keep the number of issues in our inbox on a manageable level, we are closing issues that are not going to be addressed in the foreseeable future: We look at the number of votes the issue has received and the number of duplicate issues filed. More details here. If you disagree and feel that this issue is crucial: We are happy to listen and to reconsider.
If you wonder what we are up to, please see our roadmap and issue reporting guidelines.
Thanks for your understanding and happy coding!
RafailFridman commentedon Aug 27, 2024
Are there any plans to indeed include this out of the box?
Or are there ways to deploy files to the remote machine conveniently (inside vscode) on a file save without using the sync-rsync extension?