Reputation: 13614
I have 2 machines, one is my computer that I coding and one is the remote machine that I run the codes. I want to code on my machine and sync the code as I save it to the remote machine. I know I can use ssh for that purpose in action but I want to work on the hardrive of my machine since it is faster. Is there any solution to sync my local copy to remote copy periodically? NON-DROPBOX
Upvotes: 1
Views: 237
Reputation: 7813
rsnapshot (here) or git-annex (here) would both cover your needs. rsnapshot is perhaps simpler (basically a wrapper around cron + rsync + ssh). git-annex is a little more complicated, but with the assistant it allows you a dropbox-like experience contained within your own servers.
Upvotes: 1
Reputation: 7216
The standard tool is rsync
:
rsync -r<various other options - check man for which you need> . sshuser@host:/remote/dir
For development purposes however it is much easier to just use git
(you use vcs, don't you?). The setup is somehow complicated but the advantage is that you can do it manually by git push AND only your changes (diff) is sent while rsync checks each file separatly:
post-receive
hook as describe here to itThe disadvantage of git
is that it is not suitable for the large and/or binary files such as images (well pure git).
Both solutions don't sync automatically. My believe is that it's a feature as you usually want to exactly know what you are running and either sync now ('this is critical security fix') or only when you do something - even with testing you don't want to sync when you are in middle of writing a function.
If you do want to do it you can always add a cron entry to do it.
Upvotes: 2