简体   繁体   English

在文档根目录中有SVN文件的最新副本

[英]Having latest copy of SVN'ed files in document root

A while back I asked link text and I got some great answers. 不久前,我问链接文本 ,我得到了一些很好的答案。 What I would like to know is if there is a way to keep the files under my web applications document root, and when I make a change, commit them back to the repository. 我想知道的是,是否有办法将文件保留在Web应用程序文档的根目录下,当我进行更改时,将其提交回存储库。

From what I understand, in order to work on files, they can't be in the web root. 据我了解,为了处理文件,它们不能位于网络根目录中。 Having to move them out to somewhere else just to work on them seems counter-intuitive to me. 不得不将它们移到其他地方以进行处理似乎对我来说是违反直觉的。 Am I missing something? 我想念什么吗?

Thanks! 谢谢!

Just check out the svn repo to a directory and make that directory the web root. 只需将svn存储库检出到一个目录,然后将该目录作为Web根目录即可。 You will want to have an apache policy that will not serve the .svn directory but other than that there is no issue. 您将需要一个不提供.svn目录但不存在问题的apache策略。

This is what I have in my httpd.conf to protect svn directories: 这是我在httpd.conf中用来保护svn目录的内容:

#Protect svn directories
<DirectoryMatch "^/.*/(\\.svn|CVS)/">
Order deny,allow
Deny from all
</DirectoryMatch>

in order to work on files, they can't be in the web root 为了处理文件,它们不能位于网络根目录中

There's no truth to that. 这是没有道理的。 Maybe you're thinking of the fact that files which can be modified/edited by the web server shouldn't be under the document root. 也许您在考虑这样一个事实,即可以由Web服务器修改/编辑的文件不应位于文档根目录下。 But as long as you're not using the server itself to do the editing (which would be the case if, say, you created some kind of text editor web application), it's perfectly fine and a completely normal practice to edit files in the document root. 但是,只要您不使用服务器本身来进行编辑(例如,如果您创建了某种文本编辑器Web应用程序,就会是这种情况),这是完全正常的做法,并且可以在文档根目录。

You might be interested in something like my setup: I have the repository which holds my website on the same physical machine as my web server. 您可能会对类似我的设置的内容感兴趣:我有一个存储库,用于将我的网站保存在与Web服务器相同的物理计算机上。 One working copy is checked out into the web root on that machine, and I have another working copy checked out on my laptop, where I do my development and testing. 一个工作副本被检出到该计算机上的Web根目录中,而我又在我的笔记本电脑上检出了另一个工作副本,在其中进行开发和测试。 Now the fun part: I added a hook to the SVN repository so that every time anything is committed to the repository, it automatically updates the working copy in the web root. 现在最有趣的部分是:我向SVN存储库添加了一个挂钩,以便每次向存储库提交任何内容时,它都会自动更新Web根目录中的工作副本。 This way the web root always has the latest revision of the website code, but I can still work on the site without having access to the server. 这样,Web根目录始终具有网站代码的最新版本,但是我仍然可以在该网站上工作而无需访问服务器。

EDIT : here's the script 编辑 :这是脚本

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM