Svn get current user

前端 未结 8 1645
旧时难觅i
旧时难觅i 2021-02-05 01:47

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.

相关标签:
8条回答
  • There are several ways to find out stored logon credentials:

    • Run svn auth to view credentials and certificates cached in SVN credential store (%APPDATA%\Subversion\auth).
    • Run cmdkey to view the credentials stored in Windows Credential Manager.
    • If your SVN server is integrated with Active Directory and supports Integrated Windows Authentication, your Windows logon credentials are used for authentication, but they are not cached. You can run 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.

    0 讨论(0)
  • 2021-02-05 02:28

    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.

    0 讨论(0)
  • 2021-02-05 02:32

    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".

    0 讨论(0)
  • 2021-02-05 02:38

    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.

    0 讨论(0)
  • 2021-02-05 02:38

    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.

    0 讨论(0)
  • 2021-02-05 02:42
    grep username ~/.subversion/auth/svn.simple/* --after-context=2 | tail -1
    

    Explanation:

    1. Grep the file in grep username ~/.subversion/auth/svn.simple/* will look for username

    2. --after-context=2 will print +2 line after it encounters username

    Output:

    username
    V 6
    Bhavik
    
    1. To print only the username
      use | tail -1 will give me my username i.e Bhavik.

    Hope this explains the code.

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