SVN change username

AuthenticationSvnCredentials

Authentication Problem Overview


I found a lot of examples on how to change the username for specific revisions and so on.

But what I need is this: I did a checkout with the authentication credentials of a workmate and need to change it to my credentials for future commits.

I cannot just checkout with my credentials due to the many changes that have been done already...

Anyone familiar with this?

Authentication Solutions


Solution 1 - Authentication

You can change the user with

  • Subversion 1.6 and earlier:

      svn switch --relocate protocol://currentUser@server/path protocol://newUser@server/path
    
  • Subversion 1.7 and later:

      svn relocate protocol://currentUser@server/path protocol://newUser@server/path
    

To find out what protocol://currentUser@server/path is, run

svn info

in your working copy.

Solution 2 - Authentication

The easiest way to do this is to simply use the --username option on your next checkout or commit. For example:

svn commit --username newUser

or

svn co --username newUser

It will then be cached and will be used as the default username for future commands.

See also: https://stackoverflow.com/questions/405690/in-subversion-can-i-be-a-user-other-than-my-login-name

Solution 3 - Authentication

I’ve had the exact same problem and found the solution in Where does SVN client store user authentication data?:

  1. cd to ~/.subversion/auth/.
  2. Do fgrep -l <yourworkmatesusernameORtheserverurl> */*.
  3. Delete the file found.
  4. The next operation on the repository will ask you again for username/password information.

(For Windows, the steps are analogous; the auth directory is in %APPDATA%\Subversion\).

Note that this will only work for SVN access schemes where the user name is part of the server login so it’s no use for repositories accessed using file://.

Solution 4 - Authentication

The command, that can be executed:

svn up --username newUsername

Works perfectly ;)

P.S. Just a hint: "--username" option can be executed on any "svn" command, not just update.

Solution 5 - Authentication

If your protocol is http and you are using Subversion 1.7, you can switch the user at anytime by simply using the global --username option on any command.

When Ingo's method didn't work for me, this was what I found that worked.

Solution 6 - Authentication

Go to Tortoise SVN --> Settings --> Saved Data.

There is an option to clear Authentication Data, click on the clear button, and it will allow you to select which connection you wanted to clear userid/pwd for.

After you do this, any checkout or update activity, it will reprompt for the userid and password.

Solution 7 - Authentication

for Win10 you should remove this folder and close/open your IDE

> C:\Users\User\AppData\Roaming\Subversion\auth

, also in my projects no ".subversion" folders, only ".svn"

Solution 8 - Authentication

Also, for those who happened to realize too late, that they committed with the wrong credentials, the solution (after the fact) is to change the svn author of that revision: see this question

Basically the syntax is:

svn propset --revprop -r (revision_number) svn:author (new username)

Solution 9 - Authentication

Based on Ingo Kegel's solution I created a "small" bash script to change the username in all subfolders. Remember to:

  1. Change <NEW_USERNAME> to the new username.
  2. Change <OLD_USERNAME> to the current username (if you currently have no username set, simply remove <OLD_USERNAME>@).

In the code below the svn command is only printed out (not executed). To have the svn command executed, simply remove the echo and whitespace in front of it (just above popd).

for d in */ ; \
do echo $d ; pushd $d ; \
url=$(svn info | grep "URL: svn") ; \
url=$(echo ${url#"URL: "}) ; \
newurl=$(echo $url | sed "s/svn+ssh:\/\/<OLD_USERNAME>@/svn+ssh:\/\/<NEW_USERNAME>@/") ; \
echo "Old url: "$url ; echo "New url: "$newurl ; \
echo svn relocate $url $newurl ; \
popd ; \
done

Hope you find it useful!

Solution 10 - Authentication

I believe you could create you own branch (using your own credential) from the same trunk as your workmate's branch, merge from your workmate's branch to your working copy and then merge from your branch. All future commit should be marked as coming from you.

Solution 11 - Authentication

You could ask your colleague to create a patch, which will collapse all the changes that have been made into a single file that you can apply to your own check out. This will update all of your files appropriately and then you can revert the changes on his side and check yours in.

Solution 12 - Authentication

Tortoise on windows specific:

I attempted the above solution to no available. In my use case, the credentials where stored in the windows Credential Manager under the Windows Credential section and TortoiseSVN refused to change them by running the --username command.

You can edit the credentials by expanding the url for your repo and clicking edit.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionaxel freudigerView Question on Stackoverflow
Solution 1 - AuthenticationIngo KegelView Answer on Stackoverflow
Solution 2 - AuthenticationMatt BrowneView Answer on Stackoverflow
Solution 3 - AuthenticationRaphael SchweikertView Answer on Stackoverflow
Solution 4 - AuthenticationAurimasView Answer on Stackoverflow
Solution 5 - AuthenticationAdam NuttView Answer on Stackoverflow
Solution 6 - AuthenticationWanView Answer on Stackoverflow
Solution 7 - AuthenticationbratezView Answer on Stackoverflow
Solution 8 - AuthenticationPatrice M.View Answer on Stackoverflow
Solution 9 - AuthenticationzponView Answer on Stackoverflow
Solution 10 - AuthenticationMartinView Answer on Stackoverflow
Solution 11 - AuthenticationAlexView Answer on Stackoverflow
Solution 12 - AuthenticationRussyView Answer on Stackoverflow