<p>When I try to do any svn command and supply the <code>--username</code> and/or <code>--password</code> options, it prompts me for my password anyways, and always will attempt to use my current user instead of the one specified by <code>--username</code>. Neither <code>--no-auth-cache</code> nor <code>--non-interactive</code> have any effect on this. This is a problem because I'm trying to call svn commands from a script, and I can't have it show the prompt.</p>

<p>For example, logged in as user1:</p>

<pre><code># $ svn update --username 'user2' --password 'password'
# user1@domain.com's password: 
</code></pre>

<p>Other options work correctly:</p>

<pre><code># $ svn --version --quiet
# 1.3.2
</code></pre>

<p>Why does it prompt me?<br>
And why is it asking for user1's password instead of user2's?<br>
I'm 99% sure all of my permissions are set correctly. Is there some config option for svn that switches off command-line passwords?<br>
Or is it something else entirely?</p>

<p>I'm running svn 1.3.2 (r19776) on Fedora Core 5 (Bordeaux).</p>

<hr>

<p>Here's a list of my environment variables (with sensitive information X'ed out).  None of them seem to apply to SVN:</p>

<pre><code># HOSTNAME=XXXXXX
# TERM=xterm
# SHELL=/bin/sh
# HISTSIZE=1000
# KDE_NO_IPV6=1
# SSH_CLIENT=XXX.XXX.XXX.XXX XXXXX XX
# QTDIR=/usr/lib/qt-3.3
# QTINC=/usr/lib/qt-3.3/include
# SSH_TTY=/dev/pts/2
# USER=XXXXXX
# LS_COLORS=no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:
# KDEDIR=/usr
# MAIL=/var/spool/mail/XXXXXX
# PATH=/usr/lib/qt-3.3/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin
# INPUTRC=/etc/inputrc
# PWD=/home/users/XXXXXX/my_repository
# KDE_IS_PRELINKED=1
# LANG=en_US.UTF-8
# SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
# SHLVL=1
# HOME=/home/users/XXXXXX
# LOGNAME=XXXXXX
# QTLIB=/usr/lib/qt-3.3/lib
# CVS_RSH=ssh
# SSH_CONNECTION=69.202.73.122 60998 216.7.19.47 22
# LESSOPEN=|/usr/bin/lesspipe.sh %s
# G_BROKEN_FILENAMES=1
# _=/bin/env
# OLDPWD=/home/users/XXXXXX
</code></pre>

[{'answer_id': 34755, 'author': 'Tom Mayfield', 'author_id': 2314, 'author_profile': 'https://Stackoverflow.com/users/2314', 'pm_score': 0, 'selected': False, 'text': '<p>Best I can give you is a "works for me" on SVN 1.5.  You may try adding <code>--no-auth-cache</code> to your <code>svn update</code> to see if that lets you override more easily.</p>\n\n<p>If you want to permanently switch from user2 to user1, head into ~/.subversion/auth/ on *nix and delete the auth cache file for domain.com (most likely in ~/.subversion/auth/svn.simple/ -- just read through them and you\'ll find the one you want to drop).  While it is possible to update the current auth cache, you have to make sure to update the length tokens as well.  Simpler just to get prompted again next time you update.</p>\n'}, {'answer_id': 34911, 'author': 'crashmstr', 'author_id': 1441, 'author_profile': 'https://Stackoverflow.com/users/1441', 'pm_score': 6, 'selected': False, 'text': '<p>Do you actually have the single quotes in your command? I don\'t think they are necessary. Plus, I think you also need <code>--no-auth-cache</code> and <code>--non-interactive</code></p>\n\n<p>Here is what I use (no single quotes)</p>\n\n<pre>\n--non-interactive --no-auth-cache --username XXXX --password YYYY\n</pre>\n\n<p>See the <a href="http://svnbook.red-bean.com/en/1.4/svn.serverconfig.netmodel.html#svn.serverconfig.netmodel.credcache" rel="noreferrer"><b>Client Credentials Caching</b> documentation in the svnbook</a> for more information.</p>\n'}, {'answer_id': 38386, 'author': 'Thomas Vander Stichele', 'author_id': 2900, 'author_profile': 'https://Stackoverflow.com/users/2900', 'pm_score': 6, 'selected': True, 'text': "<p>The prompt you're getting doesn't look like Subversion asking you for a password, it looks like ssh asking for a password.  So my guess is that you have checked out an svn+ssh:// checkout, not an svn:// or http:// or https:// checkout.</p>\n\n<p>IIRC all the options you're trying only work for the svn/http/https checkouts.  Can you run svn info to confirm what kind of repository you are using ?</p>\n\n<p>If you are using ssh, you should set up key-based authentication so that your scripts will work without prompting for a password.</p>\n"}, {'answer_id': 44505, 'author': 'Matt Kantor', 'author_id': 3625, 'author_profile': 'https://Stackoverflow.com/users/3625', 'pm_score': 0, 'selected': False, 'text': "<p>The problem was that the working copy was checked out via svn+ssh (thanks, Thomas).  Instead of setting up ssh keys as was suggested, I just checked out a new working copy using svn://domain.com/path/to/repo rather than svn+ssh://domain.com/path/to/repo.  Because this working copy is on the same machine as the repository itself, I'm not really missing out on anything, and I can now use the --password and --username options gratuitously.  Seems obvious now that I think about it.</p>\n"}, {'answer_id': 1002686, 'author': 'tjstankus', 'author_id': 104513, 'author_profile': 'https://Stackoverflow.com/users/104513', 'pm_score': 4, 'selected': False, 'text': '<p>I had this same issue and solved it by setting up my ~/.ssh/config file to explicitly use the correct username (i.e. the one you use to login to the server, not your local machine). So, for example:</p>\n\n<pre>\nHost server.hostname\n  User username\n</pre>\n\n<p>I found this blog post helpful: <a href="http://www.highlevelbits.com/2007/04/svn-over-ssh-prompts-for-wrong-username.html" rel="noreferrer">http://www.highlevelbits.com/2007/04/svn-over-ssh-prompts-for-wrong-username.html</a></p>\n'}, {'answer_id': 19704577, 'author': 'Znik', 'author_id': 2261349, 'author_profile': 'https://Stackoverflow.com/users/2261349', 'pm_score': 0, 'selected': False, 'text': "<p>Look to your local svn repo and look into directory .svn .\nthere is file: entries   look into them and you'll see lines begins with:\nsvn+ssh://</p>\n\n<p>this is your first configuration maked by  svn checkout 'repo_source'  or  svn co 'repo_source'</p>\n\n<p>if you want to change this, te best way is completly refresh this repository.\nupdate/commit what you should for save work. then remove completly directory\nand last step is create this by\nsvn co/checkout 'URI-for-main-repo' [optionally local directory for store]</p>\n\n<p>you should select connection method to repo  file:// svn+ssh://  http:// https:// or other\ndescribed in documentation.</p>\n\n<p>after that you use svn update/commit as usual.</p>\n\n<p>this topic looks like out of topic. better you go to superuser pages.</p>\n"}, {'answer_id': 36519216, 'author': 'Andre Holzner', 'author_id': 288875, 'author_profile': 'https://Stackoverflow.com/users/288875', 'pm_score': 0, 'selected': False, 'text': '<p>I had a similar problem, I wanted to use a different user name for a svn+ssh repository. In the end, I used <code>svn relocate</code> (as described in <a href="https://stackoverflow.com/a/13944343/288875">in this answer</a>. In my case, I\'m using svn 1.6.11 and did the following:</p>\n\n<pre><code>svn switch --relocate \\\n    svn+ssh://olduser@svnserver/path/to/repo \\\n    svn+ssh://newuser@svnserver/path/to/repo\n</code></pre>\n\n<p>where <code>svn+ssh://olduser@svnserver/path/to/repo</code> can be found in the <code>URL:</code> line output of <code>svn info</code> command. This command asked me for the password of <code>newuser</code>. </p>\n\n<p>Note that this change is persistent, i.e. if you want only temporarily switch to the new username with this method, you\'ll have to issue a similar command again after <code>svn update</code> etc.</p>\n'}]
['https://Stackoverflow.com/questions/34687', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3625/']