Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syncing local and remote #196

Closed
jbelien opened this issue May 7, 2019 · 9 comments
Closed

Syncing local and remote #196

jbelien opened this issue May 7, 2019 · 9 comments
Labels
feature-request Request for new features or functionality *out-of-scope Posted issue is not in scope of VS Code ssh Issue in vscode-remote SSH

Comments

@jbelien
Copy link

jbelien commented May 7, 2019

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 :)

Keep on the awesome work ! 👍 ❤️

(may be related to #168)

@chrmarti chrmarti added the ssh Issue in vscode-remote SSH label May 7, 2019
@egamma egamma added the feature-request Request for new features or functionality label May 7, 2019
@taiya
Copy link

taiya commented May 13, 2019

What's wrong with rsync? You can just create an action that executes the desired sync operation.

@jbelien
Copy link
Author

jbelien commented May 13, 2019

Oh well ... indeed ! I guess it could work just fine 😂

Thanks for the suggestion !

@taiya
Copy link

taiya commented 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
Copy link
Member

egamma commented May 13, 2019

//fyi @Chuxel @kieferrm didn't know about this extension, suggest to try it and see whether we can recommend it for synching?

@Chuxel
Copy link
Member

Chuxel commented May 13, 2019

@egamma @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:

{
    "remote.extensionKind": {
        "vscode-ext.sync-rsync": "ui"
    },
    "sync-rsync.local": "/Users/chuck/Developer/projects/rsync-test/remote-containers-test",
    "sync-rsync.remote": "parallels@docker-locker.local:/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.

@Chuxel
Copy link
Member

Chuxel commented 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
Copy link

beeradmoore commented Jun 1, 2019

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.

EDIT: I also just found this extension which seems promising. https://marketplace.visualstudio.com/items?itemName=liximomo.sftp

@vscodebot
Copy link

vscodebot bot commented 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!

@vscodebot vscodebot bot closed this as completed Oct 16, 2019
@ghost
Copy link

ghost commented Nov 30, 2020

it should be like in pycharm professional out of the box of the remote development feature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality *out-of-scope Posted issue is not in scope of VS Code ssh Issue in vscode-remote SSH
Projects
None yet
Development

No branches or pull requests

7 participants