Git cli: get user info from username

后端 未结 8 2079
借酒劲吻你
借酒劲吻你 2020-12-14 05:24

Is there a way to get the name of the user, given only their username?

Something like this output git show (I know this doesn\'t work)<

相关标签:
8条回答
  • 2020-12-14 06:04

    There are no "usernames" in Git.

    When creating a commit with Git it uses the configuration values of user.name (the real name) and user.email (email address). Those config values can be overridden on the console by setting and exporting the environment variables GIT_{COMMITTER,AUTHOR}_{NAME,EMAIL}.

    Git doesn't know anything about github's users, because github is not part of Git. So you're only left with an API call to github (I guess you could do that from the command line with a little scripting.)

    0 讨论(0)
  • 2020-12-14 06:04

    Add my two cents, if you're using windows commnad line:

    git config --list | findstr user.name will give username directly.

    The findstr here is quite similar to grep in linux.

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