In Subversion can I be a user other than my login name?

AuthenticationSvn

Authentication Problem Overview


I'd like to know how to get Subversion to change the name that my changes appear under.

I'm just starting to use Subversion. I'm currently using it to version control code on an XP laptop where I'm always logged in under my wife's name. I'd like the subversion DB to show the changes under my name.

Later on I'll replicate the DB so it is accessible to the whole house. My wife uses the office computer where she is always logged in under my name. I'll probably set it up so that it automatically checks in modified documents... preferably under her name.

Eventually I'll probably be using it from a linux machine under another username.

Is there some way to modify the user environment to change the user name that Subversion calls you? I'd expect something like setting SVN_USERNAME='Mark' which would override however it usually gets the name.

Update: It looks like the --username flag that Michael referred to does work to change the name reported by "svn stat", even for local file: repositories. In addition, it is sticky so you don't need to specify it for the next command. I even rebooted and it still used the "--username" value from my previous boot.

Authentication Solutions


Solution 1 - Authentication

Most Subversion commands take the --username option to specify the username you want to use to the repository. Subversion remembers the last repository username and password used in each working copy, which means, among other things, that if you use svn checkout --username myuser you never need to specify the username again.

As Kamil Kisiel says, when Subversion is accessing the repository directly off the file system (that is, the repository URL is of form file:///path/to/repo or file://file-server/path/to/repo), it uses your file system permissions to access the repository. And when you connect via SSH tunneling (svn+ssh://server/path/to/repo), SVN uses your FS permissions on the server, as determined by your SSH login. In those cases, svn checkout --username may not work for your repository.

Solution 2 - Authentication

For svn over ssh try:

svn list svn+ssh://[user_name]@server_name/path_to_repo  

svn will prompt you for the user_name's password.

Solution 3 - Authentication

You can setup a default username via ~/.subversion/servers:

[groups]
yourgroupname = svn.example.com

[yourgroupname]
username = yourusername

Please be aware that older versions of svn do not support it (e.g. 1.3.1 [sic!]).

Solution 4 - Authentication

"svn co --username=yourUserName --password=yourpassword http://path-to-your-svn"

Worked for me when on another user account. You will be prompted to enter username/password again though. You need to login like the above once and you are all set for the subsequent times(Unless you restart your machine).

Solution 5 - Authentication

If you need to specify a username other than your logged in user for use with svn+ssh [just add an entry to your .ssh/config file][1]:

Host example.com
User jdoe

[1]: http://gcc.gnu.org/wiki/SvnTricks#I.27m_also_tired_of_always_typing_mygccuserid.40gcc.gnu.org.__Am_I_able_to_set_a_default_username.3F "SVN tricks: Am I able to set a default username?"

Solution 6 - Authentication

Subversion usually asks me for my "Subversion username" if it fails using my logged in username. So, when I am lazy (usually) I'll just let it ask me for my password and I'll hit enter, and wait for the username prompt and use my Subversion username.

Otherwise, Michael's solution is a good way to specify the username right off.

Solution 7 - Authentication

Most of the answers seem to be for svn+ssh, or don't seem to work for us.

For http access, the easiest way to log out an SVN user from the command line is:

rm ~/.subversion/auth/svn.simple/*

Hat tip: http://www.yolinux.com/TUTORIALS/Subversion.html

Solution 8 - Authentication

Using Subversion with either the Apache module or svnserve. I've been able to perform operations as multiple users using --username.

Each time you invoke a Subversion command as a 'new' user, your $HOME/.subversion/auth/<authentication-method>/ directory will have a new entry cached for that user (assuming you are able to authenticate with the correct password or authentication method for the server you are contacting as that particular user).

Solution 9 - Authentication

I believe if you use the file:// method to access your subversion repository, your changes are always performed under the user which accesses the repository. You need to use a method that supports authentication such as http:// or svn://.

See http://svnbook.red-bean.com/en/1.5/svn-book.html#svn.serverconfig.choosing

Solution 10 - Authentication

If you are using svn+ssh to connect to the repository then the only thing that authenticates you and authorizes you is your ssh credentials. EVERYTHING else is ignored. Your username will be logged in subversion exactly as it is established in your ssh connection. An excellent explanation of this is at jimmyg.org/blog/2007/subversion-over-svnssh-on-debian.html

Solution 11 - Authentication

Go to ~/.subversion/auth/svn.simple/*, and you will see a list of files that contains the information about your svn user account. Just delete all others that you don't need.

After that, when you do anything that regards to SVN operation, such as commit, rm, etc,. You will be prompt again to enter username or passwords.

Solution 12 - Authentication

TortoiseSVN always prompts for username. (unless you tell it not to)

Solution 13 - Authentication

I believe you can set the SVN_USER environment variable to change your SVN username.

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
QuestionmarketsView Question on Stackoverflow
Solution 1 - AuthenticationMichael RatanapinthaView Answer on Stackoverflow
Solution 2 - AuthenticationaminalidView Answer on Stackoverflow
Solution 3 - AuthenticationblueyedView Answer on Stackoverflow
Solution 4 - AuthenticationchethanView Answer on Stackoverflow
Solution 5 - AuthenticationAaron DancygierView Answer on Stackoverflow
Solution 6 - AuthenticationBeau SimensenView Answer on Stackoverflow
Solution 7 - AuthenticationDanny SchoemannView Answer on Stackoverflow
Solution 8 - AuthenticationDon WakefieldView Answer on Stackoverflow
Solution 9 - AuthenticationKamil KisielView Answer on Stackoverflow
Solution 10 - AuthenticationcodeMonsterView Answer on Stackoverflow
Solution 11 - AuthenticationAlan DongView Answer on Stackoverflow
Solution 12 - AuthenticationrecursiveView Answer on Stackoverflow
Solution 13 - AuthenticationSophie AlpertView Answer on Stackoverflow