How to get current user that is using svn on particular workstation?
can I use svn.exe executable with some switch to get that info.
Thanks.
There are several ways to find out stored logon credentials:
svn auth
to view credentials and certificates cached in SVN credential store (%APPDATA%\Subversion\auth
).cmdkey
to view the credentials stored in Windows Credential Manager.whoami
to find out your user account name .BTW, don't miss Michael Hackner's answer:
There's no such thing as the "current user that is using svn." Every time an SVN command is submitted, credentials are supplied either explicitly at the command prompt or implicitly through saved credentials, which could include multiple users.
If you are talking about the saved credentials: either you infer it from the log or you commit something (from the mentioned workstation/server) so you can see what the log says.
In Linux, you will find the following file in your home directory:
~/.subversion/auth/svn.simple
In this file, you can see the "currently logged in user".
There's no such thing as the "current user that is using svn." Every time an SVN command is submitted, credentials are supplied either explicitly at the command prompt or implicitly through saved credentials, which could include multiple users.
If you are using SVN+SSH, then, the username of the user for a given workstation is in the config file for SVN. Assuming Windows workstation, this file will be in C:\Documents and Settings\\Application Data\Subversion folder. You can then write a script to get this name, and do what ever you need it for.
I think this is only for SVN+SSH setup. It cant work in other connectivity setups for SVN.
grep username ~/.subversion/auth/svn.simple/* --after-context=2 | tail -1
Explanation:
Grep the file in grep username ~/.subversion/auth/svn.simple/*
will look for username
--after-context=2
will print +2 line after it encounters username
Output:
username
V 6
Bhavik
| tail -1
will give me my username i.e Bhavik
. Hope this explains the code.