SVN不会缓存凭据

joe*_*010 10 svn credentials

我正在使用命令行svn客户端(版本1.6.12,来自Ubuntu repos),我似乎无法让它来缓存我的用户凭据.我正在尝试访问https svn存储库(类似于https://subversion.FAKE.com/PROJECT).我对此repo的用户名与我的本地用户名不同.

这是〜/ .subversion/config的auth部分

[auth]
### Set password stores used by Subversion. They should be
### delimited by spaces or commas. The order of values determines
### the order in which password stores are used.
### Valid password stores:
###   gnome-keyring        (Unix-like systems)
###   kwallet              (Unix-like systems)
###   keychain             (Mac OS X)
###   windows-cryptoapi    (Windows)
# password-stores = gnome-keyring
### 
### The rest of this section in this file has been deprecated.
### Both 'store-passwords' and 'store-auth-creds' can now be
### specified in the 'servers' file in your config directory.
### Anything specified in this section is overridden by settings
### specified in the 'servers' file.
### 
### Set store-passwords to 'no' to avoid storing passwords in the 
### auth/ area of your config directory.  It defaults to 'yes',
### but Subversion will never save your password to disk in
### plaintext unless you tell it to (see the 'servers' file).
### Note that this option only prevents saving of *new* passwords;
### it doesn't invalidate existing passwords.  (To do that, remove
### the cache files by hand as described in the Subversion book.)
store-passwords = yes 
### Set store-auth-creds to 'no' to avoid storing any subversion
### credentials in the auth/ area of your config directory.
### It defaults to 'yes'.  Note that this option only prevents
### saving of *new* credentials;  it doesn't invalidate existing
### caches.  (To do that, remove the cache files by hand.)
store-auth-creds = yes 
Run Code Online (Sandbox Code Playgroud)

这是〜/ .subversion/servers的全局部分

[global]
# http-proxy-exceptions = *.exception.com, www.internal-site.org
# http-proxy-host = defaultproxy.whatever.com
# http-proxy-port = 7000
# http-proxy-username = defaultusername
# http-proxy-password = defaultpassword
# http-compression = no
# http-auth-types = basic;digest;negotiate
# No http-timeout, so just use the builtin default.
# No neon-debug-mask, so neon debugging is disabled.
# ssl-authority-files = /path/to/CAcert.pem;/path/to/CAcert2.pem
#
# Password / passphrase caching parameters:
store-passwords = yes
store-plaintext-passwords = no
store-auth-creds = yes
# store-ssl-client-cert-pp = no
# store-ssl-client-cert-pp-plaintext = no
Run Code Online (Sandbox Code Playgroud)

我所做的唯一改变是明确设置一些与存储密码相关的选项.我试过设置密码存储= gnome-keyring没有效果.另外,我删除了〜/ .subversion/auth(根据其他一些线程),它仍然没有被svn客户端重新创建.

有什么建议?如何强制SVN存储我的凭据(在〜/ .subversion/auth或使用gnome-keyring,我不在乎).

cyb*_*onk 8

你至少有三个选择

  1. 设置没有密码的ssh(试试这个例子)
  2. 使用gnome-keyring(谷歌搜索'svn gnome keyring密码').这通常归结为编辑你的~/.subversion/config file(password-stores = gnome-keyringstore-passwords = yes).
  3. 将密码存储在纯文本中.

要以明文形式存储密码,请先删除~/.subversion目录.这将删除任何先前配置的项目,例如您已接受的服务器证书以及任何以前缓存的密码.下次运行svn时,它将重新创建一个"空白"目录结构.然后对存储库运行svn命令.您应该看到类似于以下内容的内容:

$> cd <project directory>
$> svn update
Error validating server certificate for 'https://...':
 - The certificate is not issued by a trusted authority. Use the
   fingerprint to validate the certificate manually!
Certificate information:
 - Hostname: ...
 - Valid: ...
 - Issuer: ...
 - Fingerprint: ...
(R)eject, accept (t)emporarily or accept (p)ermanently? p
Password for 'your username': secret
-----------------------------------------------------------------------
ATTENTION!  Your password for authentication realm:

  <https://...> ...

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
'/home/.../.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? yes
Run Code Online (Sandbox Code Playgroud)

注意!!!这将以明文保存您的密码(非常不安全),但它也会缓存您的密码,因此您不必每次都输入密码.最终密码以明文形式存储在~/.subversion/auth/svn.simple/.


小智 5

如果提到的所有选项都设置正确,则svn客户端可能由于权限而无法写入凭据文件.我发现这个线程遇到了相同的行为,权限是修复.


Ili*_*ski 1

Subversion 的配置文件存在于用户区域(您的主目录 ~/.subversion)和系统区域(/etc/subversion),请参阅http://svnbook.red-bean.com/en/1.1/ch07.html#svn -ch-7-sect-1.1。如果您有管理员权限,可以从系统文件中复制“config”和“servers”文件或直接编辑它们。

最简单但不安全的解决方案是让 subversion 将凭据缓存在普通文件中。为此,只需设置store-passwords = yes并将所有其他设置保留为默认设置(注释)。

使用 gnome-keyring 存储密码可能不起作用,因为该工具尚未安装或gnome-keyring-daemon可能未运行。