分享

subversion 出现 Repository moved permanently to...

 wangxq 2011-07-25

在使用subversion的过程中碰到过很多次的
Repository moved permanently to 'http://svn./labs/'; please relocate
刚开始的时候是把checkout下来的代码先删除了.重新checkout就好了.后来发现只要switch到checkout时候的url也正常了. 在网上也搜索过这个错误.不过别人都是checkout的时候出错的.我的都是在svn update的时候出现的.所以一直没有解决.

今天终于打到问题的原因了.原来是在subversion 的FAQ中的问题.

I can see my repository in a web browser, but 'svn checkout' gives me an error about "301 Moved Permanently". What's wrong? It means your httpd.conf is misconfigured. Usually this error happens when you've defined the Subversion virtual "location" to exist within two different scopes at the same time.
For example, if you've exported a repository as <Location /www/foo>, but you've also set your DocumentRoot to be /www, then you're in trouble. When the request comes in for /www/foo/bar, apache doesn't know whether to find a real file named /foo/bar within your DocumentRoot, or whether to ask mod_dav_svn to fetch a file /bar from the /www/foo repository. Usually the former case wins, and hence the "Moved Permanently" error.
The solution is to make sure your repository <Location> does not overlap or live within any areas already exported as normal web shares.
It's also possible that you have an object in the web root which has the same name as your repository URL. For example, imagine your web server's document root is /var/www and your Subversion repository is located at /home/svn/repo. You then configure Apache to serve the repository at http://localhost/myrepo. If you then create the directory /var/www/myrepo/ this will cause a 301 error to occur.


中文版:

我可以从一个WEB浏览器上查看我的版本库,但是在执行'svn checkout' 时发生一个错误:"301 Moved Permanently"。那个地方出错了? 这意味着你的httpd.conf配置有问题,通常情况下,当你设置的Subversion虚拟目录同时存在两种寻址方式的时候会出现这样的错误。
例如,当你将版本库放到/www/foo目录下,但是你又同时设置了你的版本库的根目录为/www,那么你就麻烦了。当有人请求 一个/www/foo/bar文件的时候,apache根本不会知道,对方真正想要寻找的文件,是在根目录里下的/foo/bar,还是通过调用 mod_dav_svn模块从/www/foo版本库中去把/bar文件给取回来,通常Apache的处理行为是采取前者的方式,因此就会出现“永久转移 ”这样的错误了。
解决这个问题的办法就是确认你的版本库路径不会有重叠,或者存在其他网络共享可访问的路径里面。
出现这个问题还有一个可能的原因,就是在网站根目录存在一个和版本库的URL同名的文件(文件夹)。例如,假设你的WEB服务器的根目录设置在 /var/www,你的Subversion版本库被放置在/home/svn/repo目录下,然后你在Apache下将该版本库的URL配置成http://localhost/myrepo。如果你这时又在/var/www下创建了一个myrepo的目录,那么同样会产生301的错误。
我在/svn/repos 下有很多个svn repository,所以就在/svn/repos下放了一个index.html来连接到各自的repository地址.所以就和上面提到的问题一样把 /svn/repos 配置成 <Location了.这样访问某个repository的时候 /repos/xx ,Apache就不确定该去解析/repos/xx下的文件.还是用mod_svn去访问版本.不过奇怪的是我只在svn update的时候才碰到,svn checkout的时候确正常.不过总算是找到问题了.把原来的/svn/repos/index.html换到其他目录再配置<Location> 一切ok了.


    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多