首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SVN不会缓存凭据

SVN不会缓存凭据
EN

Stack Overflow用户
提问于 2011-02-21 12:16:01
回答 6查看 26.4K关注 0票数 10

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

下面是~/.subversion/config的auth部分

代码语言:javascript
复制
[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的全局部分

代码语言:javascript
复制
[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

我所做的唯一改变是显式地设置了一些与存储密码相关的选项。我已经尝试设置password-store= gnome-keyring,但没有效果。此外,我删除了~/.subversion/auth (根据其他一些线程),svn客户端仍然没有重新创建它。

有什么建议吗?如何强制SVN存储我的凭据(无论是在~/.subversion/auth中还是使用gnome-keyring,我并不关心)。

EN

回答 6

Stack Overflow用户

发布于 2011-11-30 09:17:13

你至少有三个选择

  1. 设置无密码的ssh (try this example)
  2. 使用gnome-keyring (google search for 'svn gnome keyring password')。这通常归结为编辑您的密码(以明文形式编辑和store-passwords = yes).
  3. Store ~/.subversion/config file password-stores = gnome-keyring

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

代码语言:javascript
复制
$> 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/中。

票数 8
EN

Stack Overflow用户

发布于 2012-11-09 05:50:43

如果上述所有选项都设置正确,则可能是由于权限原因,svn客户端无法写入凭据文件。我发现这个线程经历了同样的行为,权限是解决问题的方法。

票数 5
EN

Stack Overflow用户

发布于 2011-02-28 20:00:23

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可能未运行。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5062232

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档