在 SVN 中执行提交后挂钩时出现身份验证错误
我有一个 SVN 提交后挂钩,可以在向存储库提交时更新工作副本。提交后挂钩执行以下命令:
/usr/bin/svn update /path/to/working/copy
在我启用 Apache mod_dav Require valid-user
指令之前,它工作正常。使用 Windows 版 tortoisesvn 客户端时,身份验证很好,因为它会要求您提供用户名和密码并保存详细信息。但由于这是一个非交互式过程,因此未提供用户名和密码,因此更新失败。
Apache 以用户和组 nobody
和 nogroup
运行,这也是拥有存储库和工作副本的用户和组。
nobody
用户没有密码,因为它无法登录。它只是用于运行 Apache 等。我尝试将 nobody
添加到 dav_svn.passwd 文件使用以下命令:
htpasswd dav_svn.passwd nobody
尝试直接在命令行运行提交后脚本时出现以下错误:
Authentication realm:
更新:
将以下内容添加到 dav_svn.conf:
Allow from 127.0.0.1
Satisfy any
修复了问题,但随后导致另一个问题,因为tortoisesvn 客户端不再需要身份验证。
I've got a SVN post-commit hook that updates a working copy when a commit is made to the repository. The post-commit hook executes the following command:
/usr/bin/svn update /path/to/working/copy
It was working fine until I enabled the Apache mod_dav Require valid-user
directive. Authentication is fine when using the tortoisesvn client for windows as it asks for your user name and password and saves the details. But as this is a non-interactive process the username and password is not supplied and the update fails.
Apache runs as user and group nobody
and nogroup
this is also the user and group that owns the repositories and the working copies.
The nobody
user does not have a password as it cannot login in. It's just used to run Apache etc. I tried adding nobody
to the dav_svn.passwd
file using the following command:
htpasswd dav_svn.passwd nobody
I get the following error when trying to run the post-commit script directly at the command line:
Authentication realm:
Update:
Adding the following to the dav_svn.conf:
Allow from 127.0.0.1
Satisfy any
Fixes the issue but then causes another issue in that the tortoisesvn client no longer requires authentication.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看起来 Apache 正在向您的 svn update 进程询问密码。这对于非交互式过程来说有点烦人。 ;-)
我认为您可能想使用直接文件系统路径而不是通过 Apache 重新签出您的工作副本。
It looks like Apache is asking your
svn update
process for a password. Which is kind of annoying for a non-interactive process. ;-)I think you might want to re-checkout your working copy using a direct file system path instead of going through Apache.
这可能会有所帮助,因为它将允许服务器访问自身:
This may help as it will allow the server to access itself: