Subversion 提交后挂钩,用于将代表与 FTP 服务器同步(对于网站)
我已在本地计算机上安装了存储库。我想做的是能够在我的计算机上本地操作网站,并使用 MAMP 之类的工具查看更改。当我提交更改时,我希望它能够将我的存储库与远程 FTP 服务器上的实时网站源文件同步。
我做了一些挖掘,我知道人们一直在说使用提交后挂钩,但我不确定如何配置它,甚至不知道如何在本地安装它。另外我不确定是否可以从我的计算机到 FTP。
有人可以提供巨大的帮助并指导我如何做到这一点吗?我已经尝试了几个小时来弄清楚如何做到这一点。
非常感谢。
I've installed a repository on my computer locally. What I'm trying to do is be able to work on a website locally on my computer and see changes using something like MAMP. When I commit a change though I'd like it to sync my repo with the live website source files on a remote FTP server.
I've done a bit of digging and I know that people keep saying to use a post-commit hook but I'm not sure how to configure it or even how to install it locally. Also i'm not sure if it's possible to do from my computer to an FTP.
Could someone be a huge help and walk me through how to do this I've been trying for hours to figure out how to do it.
thanks so much.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
subversion 服务器的 hooks 目录中有示例。根据您的平台('nix 或 windows),您可能会使用 .sh 或 .bat (目前可能使用 .tmpl 扩展名命名,我相信是“模板”)。不管怎样,你只需重命名为将要执行的东西,你就得到了一个钩子。
现在你必须修改它来调用一些可以进行 rsync 的东西。理想情况下,在单独的进程中异步(分叉一个进程,或者在 Windows 上,可能使用 START 命令),这样它就不会阻止您的提交。
现在进行同步...我认为您真正想做的是触发远程服务器上的结账。同样,这取决于平台。但想法是一样的。 'nix 上的 rsh/ssh 可能吗?
另一个想法是触发本地(在回购机器上)签出,然后使用 unison、rsync、dropbox、secondcopy 等与远程机器同步。
或者让远程机器每 10 分钟检查一次。
There are examples in the hooks directory of the subversion server. Depending on your platform ('nix or windows), you'll probably use either the .sh or .bat (may be currently named with .tmpl extension, for "template", I believe). Anyway, you just rename to something that will execute, and you've got a hook.
Now you have to modify it to call something that will do you rsync. Ideally, asynchronously (fork a process, or on windows, maybe use the START command) in a separate process, so it doesn't hold up your commit.
Now for the sync... I think what you really want to do is to trigger a checkout on the remote server. Again, this is platform dependent. But the idea is the same. rsh/ssh on 'nix maybe?
Another idea would be to trigger a LOCAL (on the repo machine) checkout, then use something like unison, rsync, dropbox, secondcopy, etc., to sync that with the remote machine.
Or have the remote machine just do a checkout every 10 min.