
是否有命令列選項可以使用 SVN 命令列自動接受 SSL 證書,從而避免出現提示?
答案1
這在一定程度上取決於您的 SVN 版本。最近的(1.6+)有常用的--non-interactive
(你想用它來避免提示),還有一個--trust-server-cert
可以做你想做的事。
答案2
使用--trust-server-cert
不會永久接受 SSL 憑證。您可以透過命令列永久接受 SSL 憑證輸入重定向並且不使用--non-interactive
.
以下是 Unix/Linux 的範例:
svn list [TARGET] << EOF
p
EOF
筆記:上面的“p”代表(p)永久。
答案3
我的解法使用expect。它並不安全,但當其他解決方案不起作用時它會起作用。
#!/usr/bin/expect -f
set svn_username [lindex $argv 0]
set svn_password [lindex $argv 1]
set svn_url [lindex $argv 2]
spawn svn --username=${svn_username} --password=${svn_password} list ${svn_url}
expect "(R)eject, accept (t)emporarily or accept (p)ermanently? "
send -- "p\r"
expect "Store password unencrypted (yes/no)? "
send "no\r"
expect -re "root@.*:\/#"
答案4
您應該能夠下載證書,然後將其放置在適當的目錄中。或者您可以下載CA證書,然後設定設定選項ssl 權限文件信任該 CA。
請參閱SSL憑證管理書中的部分。