ltribolet
ltribolet

Reputation: 21

How do I sync automatically my project in Sublime Text 2 on a remote server when I'm using Git?

So I have a project versionned with git. And I'd want to synchronize it on a server via SSH or mounted drive.

I tried the Sublime SFTP plugin but it does not sync automatically when I change branch on Git. Plus it's super slow for a plugin using Git to make the diffs.

I tried FileSync bu it does only work on saving files. So when I'm switching branch or I'm deleting files it doesn't work.

I'm on Windows and my server is a Debian which I'm not an admin of (this is my server's company) but I do have an SSH access.

What would be the best option possible to sync automatically my project over a server even when I'm using Git and switching branches ? It could be a third party option like a programm doing live sync between two folders but I didn't found one free or good enough...

Upvotes: 2

Views: 2942

Answers (2)

gnowlak
gnowlak

Reputation: 524

Try Netbeans. It does what you asked, out-of-the-box. You only need to install Git for Windows and use Git Bash separately to do all your git work, like checkout, pull, push merge and etc. When you switch branch in Git Bash, Netbeans is smart enough to delete or upload files to and from the server. If anything is not right, you can simply upload the entire local files to your server. Shouldn't do this to your production server.

Upvotes: 0

Bibhas Debnath
Bibhas Debnath

Reputation: 14939

TBH, the nearest solution would be to use deployHQ and deploy on some post-receive hook from github or whatever git solution you're using OR just run a cron job on server to pull the repo every other minute. You won't find any tool to do the exact same thing because this method is not recommended for deploying on a server. You should manually decide which commit from which branch to deploy. Maybe write a Fabric script to fetch the latest commit and deploy it.

The main reason for doing the manual work would to have control over what happens on the server. Say you push something while testing on the dev environment and it get's deployed without even being tested, possibly with bugs. You don't want that to happen.

SublimeText2 can help you to do the versioning. You can use git from inside the editor. Running fabric and all you have to do manually.

Upvotes: 1

Related Questions