SVN change username

前端 未结 11 1389
半阙折子戏
半阙折子戏 2020-12-22 19:09

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 credentia

相关标签:
11条回答
  • 2020-12-22 19:49

    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.

    0 讨论(0)
  • 2020-12-22 19:53

    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?

    0 讨论(0)
  • 2020-12-22 19:54

    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.

    0 讨论(0)
  • 2020-12-22 19:55

    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://.

    0 讨论(0)
  • 2020-12-22 19:55

    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!

    0 讨论(0)
提交回复
热议问题