在 Git 和 Subversion 中,如何在终端找到当前用户?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1409002/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
In Git and Subversion, how do I find out the current user at the terminal?
提问by Thierry Lam
回答by Dipstick
Presumably you are after the git user name that will be attached to any commits:
想必您是在将附加到任何提交的 git 用户名之后:
$ git config user.name
Wilbert Wilbert
$ git config --list
user.name=Wilbert Wilbert
[email protected]
color.status=auto
color.branch=auto
...
Keys might appear more than once because Git reads from several files (/etc/gitconfig and ~/.gitconfig, for example). Git uses the last value for each key it sees.
键可能会出现多次,因为 Git 从多个文件(例如 /etc/gitconfig 和 ~/.gitconfig)中读取。Git 使用它看到的每个键的最后一个值。
回答by abe312
For name:
对于名称:
git config user.name
For email:
对于电子邮件:
git config user.email
General:
一般的:
git config --list
(this shows all available information)
回答by bahrep
There are several ways to find out stored logon credentials that will be used when you access remote Subversion server:
有几种方法可以找出访问远程 Subversion 服务器时将使用的存储登录凭据:
- 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 .
- 运行
svn auth
以查看缓存在 SVN 凭据存储 (%APPDATA%\Subversion\auth
) 中的凭据和证书。 - 运行
cmdkey
以查看存储在 Windows 凭据管理器中的凭据。 - 如果您的 SVN 服务器与 Active Directory 集成并支持集成 Windows 身份验证,则您的 Windows 登录凭据将用于身份验证,但不会缓存它们。您可以运行
whoami
以找出您的用户帐户名。
Note that there is no such thing as "current user" in SVN. In most cases, "current user" refers to user credentials cached on client that will be automatically presented to server on every access to the server.
请注意,SVN 中没有“当前用户”这样的东西。在大多数情况下,“当前用户”是指缓存在客户端上的用户凭据,在每次访问服务器时都会自动呈现给服务器。