客户端修改代码提交到代码库正常,然后从代码库手动更新到目标目录也没问题。但是使用hook将代码库的更新自动同步到目标目录的时候,就老是提示需要存储密码。提示如下错误:
Warning: post-commit hook failed (exit code 1) with output:
-----------------------------------------------------------------------
ATTENTION! Your password for authentication realm:
lxy
can only be stored to disk unencrypted! You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible. See the documentation for details.
You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/root/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? svn: Can't read stdin: End of file found
如图所示:
解决方法一:
上面的提示信息,已经说了解决方案。是在/root/.subversion/servers文件下指明 'store-plaintext-passwords' option to either 'yes' or 'no' 可以是yes也可以是no 就是要明确指明这个option就可以了。
如果你提示的不是/root/.subversion/这个目录而是另一个目录(比如是/var/www/.subversion/)下没有servers文件,可以在~/.subversion下找到我们想要的servers这个文件。复制一份到你的目录(/var/www/.subversion/),然后编辑servers文件,加入下面的选项 :
store-plaintext-passwords = no
解决方法二:
修改代码仓库hook文件下边的自动同步文件post-commit,在执行svn更新命令的时候,加上 --no-auth-cache 。如下:
svn update /home/wwwroot/shop --username 'harry' --password 'harry' --no-auth-cache
至于如何实现代码同步参看:
SVN使用钩子实现代码同步