利用 VisualSVN hooks同步更新到web服务器

基本配置方法:
条件:
1. web 服务器安装 VisualSVN 和 TortoiseSVN
2. 客户机安装 TortoiseSVN
3. 同时在客户机和服务器创建 web 目录 , 这两个目录都是连接 VisualSVN 的
4. 同时checkout 下文件 , 使这两个目录保持版本一致,最好不要直接编辑 服务器上的 web 目录文件 防止同步错误
5. 在 C:\visualSVN\Repositories\web\hooks (根据自己的安装查找) 下建立一个 post-commit.bat 的文件内容如下:

@echo  off
“C:\visualSVN\VisualSVN Server\bin\svn.exe” update “D:\webHost” –username svn –password 000000

解析:

“svn的程序” update “服务器web 目录” –username 用户名 –password 密码

这里hooks 下有 post-commit 模板文件,不过是 linux 下用的例子
post-commit.bat 的作用就是在你用 Tortoise 进行 commit 成功后,执行一个批处理,就是 post-commit.bat 的文件。

 

以上配置好,客户端提交代码,就会提示以下错误:

Error validating server certificate for 'https://host.example.com:443':
 - The certificate is not issued by a trusted authority. Use the
   fingerprint to validate the certificate manually!
 - The certificate hostname does not match.
 - The certificate has expired.
Certificate information:
 - Hostname: host.example.com
 - Valid: from Jan 30 19:23:56 2004 GMT until Jan 30 19:23:56 2006 GMT
 - Issuer: CA, example.com, Sometown, California, US
 - Fingerprint: 7d:e1:a9:34:33:39:ba:6a:e9:a5:c4:22:98:7b:76:5c:92:a0:9c:7b

(R)eject, accept (t)emporarily or accept (p)ermanently?

...

有效解决方案:

第一步:使用管理员账户或创建一个VisualSVN Server Admins组的帐户来运行VisualSVN Server服务。

第二步:运行->services.msc->找到VisualSVNServer服务名,双击进去编辑->登录->填写管理员账户和密码或刚创建的用户名和密码->确定,重新服务。

第三步:开始->附近->按往shift键右击cmd.exe->选择“以其他用户运行”->输入管理员账户或刚创建的用户名和密码->输入:post-commit.bat文件路径,按回车->此时会提示,看最后一行:(R)eject, accept (t)emporarily or accept (p)ermanently? 按t或p,回车

以上步骤是把证书缓存在用户配置文件下,所以在svn提交不会再提示之前的证书错误。

 

posted on 2013-06-25 17:01  一个石头  阅读(1122)  评论(0)    收藏  举报