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?
This question is related to
authentication
svn
credentials
I’ve had the exact same problem and found the solution in Where does SVN client store user authentication data?:
cd
to ~/.subversion/auth/
.fgrep -l <yourworkmatesusernameORtheserverurl> */*
.(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://
.
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: In Subversion can I be a user other than my login name?
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.
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.
Based on Ingo Kegel's solution I created a "small" bash script to change the username in all subfolders. Remember to:
<NEW_USERNAME>
to the new username.<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!
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.
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.
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"
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)
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.
Source: Stackoverflow.com