apache 为什么 Subversion 不允许提交 .htaccess 文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1574655/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Why doesn't Subversion allow to commit .htaccess files?
提问by user38968
I can't commit .htaccess files from my Windows SVN client (TortoiseSVN). The error that is returned is:
我无法从我的 Windows SVN 客户端 (TortoiseSVN) 提交 .htaccess 文件。返回的错误是:
Could not read status line: Existing connection was forcibly closed by the remote host.
无法读取状态行:现有连接被远程主机强行关闭。
And here is basically what my vhost looks like in Apache:
这基本上是我的 vhost 在 Apache 中的样子:
<VirtualHost *:80>
DocumentRoot /var/www/mydomain.com/legacy/trunk/html
ServerName mydomain.com
<Directory /var/www/>
FileETag MTime Size
AllowOverride All
</Directory>
<Directory /var/www/tools>
AllowOverride All
</Directory>
<Location /svn>
DAV svn
SVNPath /var/svn/repos/MyRepo
# Limit write permission to list of valid users.
# Require SSL connection for password protection.
# SSLRequireSSL
ErrorDocument 404 default
AuthType Basic
AuthName "Authorization Realm"
AuthUserFile /etc/httpd/conf/.htpasswd
Require valid-user
</Location>
</VirtualHost>
How can this be changed, so that .htaccess files can be committed?
如何更改,以便提交 .htaccess 文件?
回答by Martin Zeitler
Just found out how to fix that issue - just put this into your virtual host configuration in order to override global http.conf:
刚刚发现如何解决该问题 - 只需将其放入您的虚拟主机配置中即可覆盖全局 http.conf:
<Files ~ "^\.ht">
Order allow,deny
Allow from all
Satisfy All
</Files>
THIS is the correct answer for sure (tested), but the op abandoned his question :/
这肯定是正确的答案(经过测试),但操作员放弃了他的问题:/
回答by Dean J
Subversion is being served from an Apache server that's also using .htaccess for access control, so it might be preventing you from doing something you don't quite intend.
Subversion 是由 Apache 服务器提供的,该服务器也使用 .htaccess 进行访问控制,因此它可能会阻止您做一些您不太想要的事情。
回答by Stefan
check the apache error log file. You might see additional info about why the svn server failed to finish the commit.
检查 apache 错误日志文件。您可能会看到有关 svn 服务器未能完成提交的原因的其他信息。
回答by leander
Check other apache config files. In my default /etc/apache2/modules.d/00_default_settings.conf (on a gentoo install), I have a FilesMatch "^.ht"section that does Deny from all.
检查其他 apache 配置文件。在我的默认 /etc/apache2/modules.d/00_default_settings.conf(在 gentoo 安装中)中,我有一个FilesMatch "^.ht"部分执行Deny from all.
I'd suggest running a grep -r -i "\\.ht" *from the /etc/apache or /etc/httpd or /etc/apache directory, to see what you come up with.
我建议grep -r -i "\\.ht" *从 /etc/apache 或 /etc/httpd 或 /etc/apache 目录运行一个,看看你想出了什么。
It may also be an AccessFileNamedirective, so grep for that too.
它也可能是一个AccessFileName指令,所以 grep 也是如此。
回答by si618
Are other files committing from TortoiseSVN?
其他文件是否从 TortoiseSVN 提交?
If the commit is working from an SVN client on the same box as TortoiseSVN on the same working copy (can you verify?), then my guess would be different SVN and TortoiseSVN client versions causing the problem.
如果提交是从与 TortoiseSVN 在同一个工作副本上的同一台机器上的 SVN 客户端进行的(你能验证吗?),那么我的猜测是不同的 SVN 和 TortoiseSVN 客户端版本导致了问题。
TortoiseSVN -> Aboutwill report the SVN client version is was built with. Check that your client/server versions are compatible.
TortoiseSVN -> About将报告 SVN 客户端版本是用它构建的。检查您的客户端/服务器版本是否兼容。
回答by user1280545
<Files ~ "^\.ht">
Order allow,deny
Allow from all
Satisfy All
</Files>
This worked for me too. With a slight complexity I was doing it on a plesk server.
这对我也有用。我在 plesk 服务器上做这件事有点复杂。
After adding above lines to my vhost file created in
将以上几行添加到我创建的 vhost 文件后
/var/www/vhosts/system/[your domain]/conf
I ran following to rebuild the conf files
我运行以下以重建 conf 文件
/usr/local/psa/admin/sbin/httpdmng --reconfigure-domain [your domain]
and the comit worked!
并且提交成功了!
Thanks, hope this helps people using plesk
谢谢,希望这对使用 plesk 的人有所帮助

