davidolrik / sublime-rsync-ssh Goto Github PK
View Code? Open in Web Editor NEWKeep remote directories in sync with local projects.
Keep remote directories in sync with local projects.
Using ST3 Build 3059 on Windows 8.
Traceback (most recent call last):
File "D:\Archivos de programa\Sublime Text 3\sublime_plugin.py", line 549, in run_
return self.run(edit)
File "C:\Users\Guillermo\AppData\Roaming\Sublime Text 3\Packages\sublime-rsync-ssh\rsync-ssh.py", line 38, in run
"remote_path": "/home/" + os.environ['USER'] + "/Projects/" + os.path.basename(folder.get("path")),
File "X/os.py", line 669, in __getitem__
KeyError: 'USER'
Traceback (most recent call last):
File "/opt/sublime_text/sublime_plugin.py", line 549, in run_
return self.run(edit)
File "rsync-ssh in /home/oleg/.config/sublime-text-3/Installed Packages/Rsync SSH.sublime-package", line 35, in run
TypeError: 'NoneType' object is not iterable
If you have enabled sync on save and save a file on the excludes list, or a file in a folder on the excludes list, it is synced by sync on save.
My work server has something like an MOTD that is outputted to the terminal, even for non-interactive ssh sessions (ugh). I don't exactly know where/how the message is coming from but I know that .hushlogin
doesn't suppress it and that it trips up rsync-ssh's sanity check for ssh and rsync. Specifically the re.match
method sees the welcome message instead of rysinc is ...
. Adding -q
to the ssh
command (in check_command
) corrects the problem.
This might just be something I need to take up with my sysadmin, but as an alternative perhaps you could let the user add options to the ssh
command if not just hardcoding in the q
switch.
I haven't spent any time looking into the code, but I have noticed that when I have spaces in my folder names, the content is sent to a container folder up in the hierarchy tree and not to the specific file.
So for example, if we had:
"ALongPath/With/Some Path/To a File.txt"
The contents of "To a File.txt" would show up on the remote system as:
"ALongPath/With/Some"
I've getting this error when trying to sync the whole project (⇧⌘F12):
[rsync-ssh] Aborting! - rsync ssh is not configured!
{
"folders": [
{
"follow_symlinks": true,
"path": "."
}
],
"settings": {
"rsync_ssh": {
"excludes": [
".git*",
],
"options": [
"--delete"
],
"remotes": {
"site": [
{
"enabled": 1,
"excludes": [],
"options": [],
"remote_host": "example.com",
"remote_path": "/path/to/remote",
"remote_port": 22,
"remote_post_command": "",
"remote_pre_command": "",
"remote_user": "matt"
}
]
},
"sync_on_save": true
}
}
}
(I've anonymized the project.)
Hi.
I tried to init a couple of times settings in my project folder.
Nothing happened, then I opened the console and see this:
Traceback (most recent call last):
File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 818, in run_
return self.run(edit)
File "rsync_ssh in /Users/alex.buznik/Library/Application Support/Sublime Text 3/Installed Packages/Rsync SSH.sublime-package", line 124, in run
AttributeError: 'NoneType' object has no attribute 'run_command'
[rsync-ssh] rsync_ssh configuration already exists.
No new files were created though.
What could be the problem?
OS X 10.13.2, ST 3.0
I know this is a support issue, but figure it might be the best place to ask.
Began my attempts at setting this up today, on Windows 10. I'm not using Cygwin, but rsync is available on my machine. I am able to ssh into my server via a key, but rsync fails with the following:
[rsync-ssh] server[project]: rsync -v -zar -e ssh -q -T -o ConnectTimeout=10 -p YY --no-perms --chmod=ugo=rwX /d/var/remote/project/ user@server:'/var/props/workbench' --exclude=.git* --exclude=Build --exclude=_build --exclude=.DS_Store --exclude=blib
[rsync-ssh] server[project]: ERROR: rsync: connection unexpectedly closed (0 bytes received so far) [sender]
[rsync-ssh] server[project]: rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=3.1.2]
At first I figured it was a firewall thing, but that can't be right as I can actually ssh in. Rsync is running as a service on the server as well, if that makes any difference... Could it perhaps be an rsync thing? Maybe the two rsyncs are not compatible with one another?
I'm getting the following error when I try to sync a folder that has it's name repeated in the path:
Traceback (most recent call last):
File "./threading.py", line 901, in _bootstrap_inner
File "/Users/david.dovel/Library/Application Support/Sublime Text 3/Packages/sublime-rsync-ssh/rsync-ssh.py", line 165, in run
[split_prefix, subfolder] = str.split(remote_key, folder_path_basename, 2)
ValueError: too many values to unpack (expected 2)
syncing /Developer/vagrant-proj1/projects/proj1
causes this issue
syncing /Developer/vagrant-proj1/projects/proj2
does not
With the last rsync update, from 3.2.3 to 3.2.4, the way arguments are processed has changed, which in result breaks this addon.
You can read more about the changes here: https://download.samba.org/pub/rsync/NEWS#3.2.4
A very simple, locally tested, fix is to add "--old-args" to the argument when a rsync version > 3.2.3 is detected.
Hope that help, cheers
Hi.
Thank you for this great plugin.
I started it using a lot on my work machine.
At home though nothing happens after initialization - I set the correct host/path/user etc., but the Sync from Remotes line does not appear in Project>RSync SSH, not in the context menu over the root folder.
Nothing strange in the console either.
What should I look for?
Would love to install via package control in sublime text 3 but searching both rsync-ssh
and Rsync SSH
doesn't yield any results. Only package that does show up is a year old or so rsync package by a different author.
Hello,
I've stumbled over a problem where the plugin will sync with multiple destinations though only one was selected. It should be reproducible with a config of this kind:
"remotes":
{
"project":
[
{
"enabled": 1,
"excludes":
[
],
"options":
[
],
"remote_host": "127.0.0.1",
"remote_path": "/srv/dev",
"remote_port": 22,
"remote_post_command": "",
"remote_pre_command": "",
"remote_user": ""
},
{
"enabled": 1,
"excludes":
[
],
"options":
[
],
"remote_host": "127.0.0.1",
"remote_path": "/srv/dev_test",
"remote_port": 22,
"remote_post_command": "",
"remote_pre_command": "",
"remote_user": ""
}
],
}
The problem is that syncing to /srv/dev
will do that but also sync with /srv/dev_test
which is not what I want. I've looked into it and the plugin uses string inclusion logic to do file system checks and tries to retrace the user choice also by passing strings instead of the actual choice.
I've forked and fixed it on my side by rewriting RsyncSSH
. It's the version I'm using right now, so there are some changes by now:
sync_on_save
so didn't touch itMaybe this affects somebody else and my logic works for you to. My fork
If I open another view to the same file using Sublime's "File -> New View into File" menu, I have doubled syncs for this file for every destination.
Hi, for some reason it doesn't work when using a debian squeeze remote.
When saving here what the console tells :
[rsync-ssh] obstinato.fr[v2]: ERROR: Unable to locate rsync on my.domain
[rsync-ssh] obstinato.fr[v2]: rsync est /usr/bin/rsync
[rsync-ssh] obstinato.fr[v2]:
With these settings:
{
"folders":
[
{
"follow_symlinks": true,
"path": "/Applications/AMPPS/www/aaa/bbb"
}
],
"settings":
{
"rsync_ssh":
{
"excludes":
[
"log/",
"tmp/"
],
"options":
[
],
"remotes":
{
"/Applications/AMPPS/www/aaa/bbb":
[
{
"enabled": 1,
"excludes":
[
],
"options":
[
],
"remote_host": "109.168.113.241",
"remote_path": "/var/www/aaa/bbb",
"remote_port": 22,
"remote_post_command": "",
"remote_pre_command": "",
"remote_user": "ben"
}
]
},
"sync_on_save": true
}
}
}
I have this output. It seems to ignore my excludes!
rsync -v -zar -e ssh -q -p 22 -o ConnectTimeout=10 /Applications/AMPPS/www/aaa/bbb/ [email protected]:/var/www/aaa/bbb
rsync_command = [
"rsync", "-v", "-zar",
"-e", "ssh -q -T -p " + str(self.remote.get("remote_port", "22")) + " -o ConnectTimeout="+str(self.timeout)
]
Hi,
at first thx, finally a working sync plugin, i was waiting for this a long time. :)
Anyway, it would be nice if a single subfolder could be synced like this:
source:
/folder/a/b/
target:
/target/b/
I have multiple folders in my project but i don't want to sync each root folder, just subsets of the child folders.
Project settings example:
"folders":
[
{
"path": "/folder/a"
}
]
"remotes":
{
"/folder/a/b":
[
{
"enabled": 1,
"remote_host": "localhost",
"remote_path": "/target/b",
}
],
Hello, I found your project to be perfect for my goal of using rsync and sublime text instead of ftp.
I'm trying to use this plugin on windows to connect to linux and I couldn't figure out a configuration that works for key authentication using cygwin. I did get it working without a password being required, so I know there wasn't anything failing except ssh authentication. I assume this is easier on a mac or linux machine where ssh is native. It seems like a pain to have to deal with cygwin since ssh-agent doesn't seem to work or I lack the knowledge after trying a few things. I looked into modifying your plugin to add the ssh key path argument to the rsync / ssh command and found that to be an easier solution.
I suggest adding a feature to the open source project to make it easier for others to set their ssh private key path in the sublime-project file like this:
in sublime-project settings:
after "remote_port": 2222,
add:
"ssh_key_path":"/absolute/path/to/private_key",
and then in rsync_ssh.py after this line:
if self.destination.get("remote_port"):
ssh_command.extend(["-p", str(self.destination.get("remote_port"))])
add this:
if self.destination.get("ssh_key_path"):
ssh_command.extend(["-i", str(self.destination.get("ssh_key_path"))])
This worked for me, and this lets me use a simple setup for cygwin on windows.
Or if you know a better way, perhaps provide some docs for it since authentication is the one thing lacking in the current readme.
Thanks for making this plugin and good job with the docs and feature set so far!
For example if I need to run a command as sudo, I'll need to add -tt argument to the ssh command.
PS thanks for this awesome plugin
Hi!
First time tester.
To help you debug, here is my info:
>>> sublime.active_window().folders()
['/Users/Einar/Dropbox/Projects/coretrek/loftet']
>>> os.path.basename('/Users/Einar/Dropbox/Projects/coretrek/loftet')
'loftet'
>>> sublime.active_window().active_view().settings().get("rsync_ssh").get("remotes")
{'.': [{'remote_port': 22, 'enabled': 1, 'remote_host': 'xxx', 'excludes': [], 'remote_post_command': '', 'remote_path': '/home/projects/xxx/.', 'remote_user': 'xxx', 'options': [], 'remote_pre_command': ''}]}
My sublime-project: https://gist.github.com/eigan/dc1ba5ed55bbda9fb2d9
Issue fixed when I renamed my remotes in settings to "loftet", from the default value "."
Error is at rsync-ssh.py:122 or something.
I have no doubt that this is a me issue rather than a plugin issue, but I think I have everything configured properly and yet I see that message in my console when I save something or try to do a complete upload. My project settings file (my-project.sublime-project
) contains the following:
{
"folders":
[
{
"path": "/Users/robwilkerson/Developer/www/my-project"
}
],
"settings":
{
"rsync_ssh":
{
"excludes":
[
".git*",
"_build",
"blib",
"Build"
],
"options":
[
"--dry-run",
"--links",
"--delete"
],
"remotes":
{
"/Users/robwilkerson/Developer/www/my-project":
[
{
"enabled": 1,
"excludes":
[
],
"options":
[
],
"remote_host": "my.devserver.net",
"remote_path": "/home/robwilkerson/my-project",
"remote_port": 22,
"remote_post_command": "",
"remote_pre_command": "",
"remote_user": "robwilkerson"
}
]
}
}
}
}
What am I missing here?
Thanks.
Hi. Everything was working properly on linux. Now on Windows I get this errors:
Here's the full console output on a fresh run:
Traceback (most recent call last):
File "./threading.py", line 901, in _bootstrap_inner
File "rsync_ssh in D:\Program Files\Sublime Text 3\Data\Installed Packages\Rsync SSH.sublime-package", line 460, in run
File "rsync_ssh in D:\Program Files\Sublime Text 3\Data\Installed Packages\Rsync SSH.sublime-package", line 43, in check_output
File "./subprocess.py", line 576, in check_output
File "./subprocess.py", line 824, in __init__
File "./subprocess.py", line 1118, in _execute_child
FileNotFoundError: [WinError 2] The system cannot find the file specified
It would be sweet if I could see that that sync have started, instead of waiting for notification that the sync completed / failed.
I have seen other plugin use view.set_status(). I think using this for both sync start and done would be nice.
Writing file /project-path/app.php with encoding UTF-8 (atomic)
Exception in thread Thread-13:
Traceback (most recent call last):
File "./threading.py", line 901, in _bootstrap_inner
File "rsync-ssh in ~/Library/Application Support/Sublime Text 3/Installed Packages/Rsync SSH.sublime-package", line 151, in run
AttributeError: 'NoneType' object has no attribute 'keys'
my os is
10.10.2
Sublime Text 3065
Dear Sir,
after setting some parameters during initialization, I am unable to obtain error logs. How can I obtain error logs ?
Thanks for your reading
and my setting is :
{
"folders":
[
{
"path": "/Users/****/repo/AAA",
}
],
"settings":
{
"rsync_ssh":
{
"ssh_args": ["-F", "~/.ssh/config"],
"excludes":
[
".git*",
"_build",
"blib",
"Build"
],
"options":
[
"--delete"
],
"remotes":
{
"/Users/****/repo/windDiffUFSEC":
[
{
"command": "rsync",
"enabled": 1,
"excludes":
[
],
"options":
[
],
"remote_host": "HX1142",
"remote_path": "/mnt/PRESKY/user/zhangyongpeng/repo/windDiffUFSEC",
"remote_port": 1030,
"remote_post_command": "",
"remote_pre_command": "",
"remote_user": "****"
}
]
},
"sync_on_save": false
},
},
}
Is it possible?
There's error when check output of subprocess in Chinese language & Mac OS.
Exception in thread Thread-33:
Traceback (most recent call last):
File "./python3.3/threading.py", line 901, in _bootstrap_inner
File "/Users/faywong/Library/Application Support/Sublime Text 3/Installed Packages/Rsync SSH.sublime-package/rsync_ssh.py", line 567, in run
output = check_output(rsync_command, stderr=subprocess.STDOUT)
File "/Users/faywong/Library/Application Support/Sublime Text 3/Installed Packages/Rsync SSH.sublime-package/rsync_ssh.py", line 43, in check_output
return subprocess.check_output(*args, universal_newlines=True, startupinfo=startupinfo, **kwargs)
File "./python3.3/subprocess.py", line 578, in check_output
File "./python3.3/subprocess.py", line 907, in communicate
File "./python3.3/subprocess.py", line 479, in _eintr_retry_call
File "./python3.3/encodings/ascii.py", line 26, in decode
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 50: ordinal not in range(128)
May be
import sys
reload(sys)
sys.setdefaultencoding(‘utf8′)
helps.
Sorry about bad summary but I'm just confused after trying this plugin. :)
So basically it seems to be quite broken on first sight, for someone who doesn't go beyond documentation. Are these actual bugs or I'm missing something?
Suddently, rsync has stopped working. It seems that there is a misconception of the host path. Here my conf:
{
"folders":
[
{
"follow_symlinks": true,
"path": "/home/ben/Scrivania/qboxmail_panel-PROD"
}
],
"settings":
{
"rsync_ssh":
{
"excludes":
[
],
"options":
[
],
"remotes":
{
"qboxmail_panel-PROD":
[
{
"enabled": 1,
"excludes":
[
"tmp/",
"log/"
],
"options":
[
],
"remote_host": "***",
"remote_path": "/var/www/cbsolt/qboxmail_panel-PROD",
"remote_port": 22,
"remote_post_command": "",
"remote_pre_command": "",
"remote_user": "***"
}
]
},
"sync_on_save": true
}
}
}
It ha salways worked, but today, it doesn't work. I have opened the shell, and here is the command that create:
rsync -v -zar -e ssh -q -T -p 22 -o ConnectTimeout=10 /home/ben/Scrivania/qboxmail_panel-PROD/qboxmail_panel-PROD/ [email protected]:/var/www/cbsolt/qboxmail_panel-PROD --exclude=.DS_Store --exclude=log/ --exclude=tmp/
As you can see, the folder qboxmail_panel-PROD is ducplicated in the url. But the pwd of the file is this:
/home/ben/Scrivania/qboxmail_panel-PROD
Hello,
Is it possible to use rsync in Windows ?
I read Dropbox is using rsync for synchronization of files. How to sync folders if source is Windows OS and destination is Linux server ?
or if both source and destinations are Windows OS ?
Please help me.
Using Package Control....
what's the plugin name, can't find it.
Thx ;)
It would be useful to allow rsync back to the local directory on a hotkey or command. My current workflow allows me to edit locally, but all of the git information is stored on the remote machine so if I were to rebase/merge I can't get those changes locally unless I rsync the project manually.
This is a great plugin, btw.
Is there an easy way to update gulp so that it triggers something for this plugin to sync? Right now I have to wait for gulp to finish and then perform a manual sync which usually take a few seconds longer than the regular sync.
Hi,
at first of all thanks for this awesome plugin for SublimeText :)
Do you think there is a possibility to make syncing automatically?
Just like "auto_sync": true
in config json for example?
I am working in an environment where I rely on different (auto-generated) SSH config files
I can add the custom SSH parameters via
"options": [ "--rsh='ssh -F /Path/To/My/ssh_config_dev'", ],
However, this causes the check command to fail:
[rsync-ssh] container[fc.directory]: ssh -q -T -o ConnectTimeout=10 ctheune@container LANG=C which rsync
I think I can work around this for a while by using a custom SSH command, but that's hacky. I'm happy to contribute a patch with an option for custom SSH parameters (and then make that create the --rsh
option as well.
I have trouble with following rsync command, which was generated by your plugin:
rsync -v -zar -e ssh -q -T -p 22 -o ConnectTimeout=10 --dry-run --delete /Users/~/index.html ubuntu@~/index.html --exclude=.DS_Store --exclude=.ropeproject --exclude=.*.swp --exclude=.git
which should be fixed like this:
rsync -v -zar -e "ssh -q -T -p 22 -o ConnectTimeout=10" --dry-run --delete /Users/~/index.html ubuntu@~/index.html --exclude=.DS_Store --exclude=.ropeproject --exclude=.*.swp --exclude=.git
Please refer following SO:
http://stackoverflow.com/questions/18270512/rsync-and-ssh-on-android-no-such-file-or-directory
Hello,
"sync_on_save" does not work if there are more than one remotes in the same project.
Regards,
Alan
With the current setup it is not possible to leave out ssh parameters and fall back to what is configured within .ssh/config. It would be better not to enforce that (e.g. setting -p 22
when remote_port
is unset) but falling back to what is configured in .ssh/config (so simply omit the parameters from the rsync call that are unset). That way the {my}.sublime-project
could be shared between users and put under revision control. E.g.
.ssh/config
(user foo):
Host remotedev.example.com
HostName foo-dev.example.com
User foo
Port 12345
IdentityFile ~/.ssh/dev-foo.example.id
.ssh/config
(user bar):
Host remotedev.example.com
HostName bar-dev.example.com
User bar
Port 54321
IdentityFile ~/.ssh/dev-bar.example.id
{my}.sublime-project
:
"remotes": {
"/my/projectpath": [
{
"enabled": 1,
"excludes": [],
"options": [],
"remote_host": "remotedev.example.com",
"remote_path": "/my/projectpath/api"
}
]
}
I have the remote_post_command
defined and set to make
and the plugin sometimes fails to parse the output of my make
command with the following exception:
Exception in thread Thread-8:
Traceback (most recent call last):
File "./threading.py", line 901, in _bootstrap_inner
File "rsync_ssh in /Users/ay/Library/Application Support/Sublime Text 3/Installed Packages/Rsync SSH.sublime-package", line 581, in run
File "rsync_ssh in /Users/ay/Library/Application Support/Sublime Text 3/Installed Packages/Rsync SSH.sublime-package", line 43, in check_output
File "./subprocess.py", line 578, in check_output
File "./subprocess.py", line 915, in communicate
File "./subprocess.py", line 479, in _eintr_retry_call
File "./encodings/ascii.py", line 26, in decode
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 117: ordinal not in range(128)
UPD
In fact this is easily reproducible by setting the remote_post_command
to this: echo '‘'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.