4

I have found this question, but it was never resolved and don't want to hijack it for myself. I'll try and give as many details as possible.

I have a shared hosting account on a Linux server which is my web server, and I have shell access.

I'm working from a Windows machine using TortoiseSVN.

I have several web sites in my public_html/ on the hosting server and would like to be able to have any changes made on my Windows machine be propagated to the server with minimum fuss. I basically want to get away from manually uploading over FTP.

I would be happy to keep all my revisions, but don't actually ever need to see them really, certainly not from a web interface. All I want to see from the web is the current revision.

Hopefully that's most of the detail sorted, now for the actual question. What's the best way to set my SVN to work in my public_html folder without exposing all my .svn directories to the public?

4

2 回答 2

1

I would advice against using a checkout working copy on production. The best way to upload to production is export. If you want something automatically you could look into some deployment script like Capistrano.

If you still want to do it .. you could use a htacccess to hide them:

<FilesMatch "\.svn/.*">
   order deny,allow
   deny from all
</FilesMatch>

<Files .htaccess>
   order deny,allow
   deny from all
</Files>
于 2010-01-25T13:04:19.933 回答
1

您可以将 Apache 配置为禁止访问.svn目录,但您仍然需要远程服务器可以访问本地 Subversion 存储库,以及需要配置保护的所有内容:加密、身份验证、路由器、防火墙......

我认为灵活性和简单性之间的最佳折衷实际上是使用 FTP,但使用文件同步工具来实现。您可以将工作副本导出到临时目录并从那里同步,或者将工具配置为忽略 .svn 目录。同步过程可能很慢,但自动化并不重要。

另外,不要忘记非版本控制文件。有些需要手动更新(例如从版本化模板创建的设置文件),有些需要忽略(例如缓存文件和用户数据)。

至于完成这一切的魔法工具……我仍在寻找合适的工具。到目前为止,我正在使用SyncBack 免费软件。它可以完成这项工作,但它被设计为备份工具,因此很难配置。

于 2010-01-25T16:46:36.677 回答