强制 svn 用户并使用私有子目录更新签出
我有一个 Subversion 树,其中只有一些公共目录。最后一个目录仅对用户“me”可用。
/trunk/public1
/trunk/public2
/trunk/private1
当我检查 trunk
时,我得到了 /public1
和 /public2
,但没有得到 /private1
。系统不会要求我提供凭据,因为 Subversion 认为它可以自动检查公共目录。
- 我如何强制 Subversion 以“我”的身份签出此目录,以便我可以获得所有目录?我原以为这就像在命令行上添加
--username
一样简单——但这不起作用! - 但是,如果我已经检查了这个目录结构并且只有公共目录怎么办?我已经改用“me”,因为我可以毫无问题地进行提交。但无论我做什么,
/private1
目录都不会显示。如何使用私有目录更新我的本地副本?
更奇怪的是我可以(在目录内):
svn update private1
并且 Subversion 显然成功了,没有错误或警告——但我仍然没有得到目录。 (当然我也可以更新不存在的 private2
,并且仍然不会收到错误或警告,所以我想这没有任何意义。)
这是我的 Subversion 授权的相关部分Apache 上的文件:
[groups]
developers=me
[foo:/trunk]
@developers=rw
*=r
[foo:/trunk/private1]
@developers=rw
*=
我可以使用 WebDAV 上的浏览器浏览到 /trunk/private1
(在我输入用户“me”的正确凭据之后)。
I have a Subversion tree that only has some directories public. The last directory is only available for user "me".
/trunk/public1
/trunk/public2
/trunk/private1
When I do a checkout of trunk
, I get /public1
and /public2
, but not /private1
. I'm not asked for my credentials, because Subversion sees it can automatically check out the public directories.
- How do I force Subversion to check out this directory as "me" so I can get all the directories? I had assumed this would be as easy as adding
--username
on the command line---but that doesn't work! - But what if I've already checked out this directory structure and only have the public directories? I've already switched to use "me" because I can do commits with no problem. But whatever I do, the
/private1
directory does not show up. How can I update my local copy with the private directory?
What makes this even stranger is that I can do (inside the directory):
svn update private1
and Subversion apparently succeeds with no errors or warnings---but I still don't get the directory. (of course I can also update private2
, which doesn't exist, and still get no errors or warnings, so I guess this doesn't mean anything.)
Here is the relevant parts of my Subversion authorization file on Apache:
[groups]
developers=me
[foo:/trunk]
@developers=rw
*=r
[foo:/trunk/private1]
@developers=rw
*=
I can browser to /trunk/private1
just fine using my browser over WebDAV (after I enter the correct credentials for user "me").
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请参阅 Subversion 中的基于路径的授权部分手动的。特别是阅读页面上最后一个灰色框。
根据此信息,服务器似乎发现它可以在没有凭据的情况下检出根文件夹,然后以匿名方式执行整个检出。由于您只有一次进行身份验证的机会,因此当您访问私有目录时您仍然是匿名的,因此您不会获得它们的副本。如果您需要像这样获得访问保护的目录,请在 initial
svn checkout
命令中使用--username
选项。我不知道您是否可以使用一组凭据将文件夹签出到使用另一组凭据签出的工作副本的中间(这样做会使 svn commit 令人困惑,因为每次提交只能有一个作者)。使用网络浏览器浏览源代码是完全不同的,因为服务器可以在每次加载新页面时要求身份验证。
See the section on path-based authorization in the Subversion manual. In particular, read the last grey box on the page.
Based on this information, it looks like the server sees that it can check out the root folder without credentials and is then doing the entire checkout anonymously. Since you only have one chance to authenticate, you're still anonymous when you get to the private directories so you don't get a copy of them. If you need to get access-protected directories like this, use the
--username
option on the initialsvn checkout
command. I don't know that you cancheckout
a folder using one set of credentials into the middle of a working copy that was checked out using a different set of credentials (doing so would makesvn commit
confusing, because each commit can only have one author).Browsing the source using a web browser is a different animal entirely, as the server can ask for authentication every time a new page loads.