SVN不会缓存凭据

时间:2011-02-21 04:16:01

标签: 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 

这是〜/ .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

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

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

6 个答案:

答案 0 :(得分:8)

您至少有三个选择

  1. 设置没有密码的ssh(try this example
  2. 使用gnome-keyring(google search for 'svn gnome keyring password')。这通常归结为编辑~/.subversion/config filepassword-stores = gnome-keyringstore-passwords = yes)。
  3. 以明文形式存储密码。
  4. 要以明文形式存储密码,请先删除~/.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
    

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

答案 1 :(得分:5)

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

答案 2 :(得分: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可能未运行。

答案 3 :(得分:0)

不确定你是否还在寻找答案;但是选项“ssl-client-cert-password”可能就是你要找的那个。

ssl-client-cert-password=<password>

答案 4 :(得分:0)

不知道这是否已经解决,但您是否尝试过添加

password-stores = 

到'config'文件?

答案 5 :(得分:0)

在您的配置中有一个选项store-plaintext-passwords = no,它禁止在$ HOME / .subversion中存储密码,除非有一些支持的加密可用。

要恢复到1.6之前的行为,您可以将值更改为yes,这样可以保存密码。

相关问题