Git cli: get user info from username

check git username
git config username and password
git set username
github username
git set username and password global
github username and password
getting started with git bash
git login command line

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

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

username: username
name: First Last
email: email@address

I know I can do this with a GitHub api call, but would prefer to keep it within the CLI.

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

How to show or change your Git username or email address , Git user FAQ: How do I show or change my Git username (or email address)? There are at least three ways to show your Git username: The git config How-to​: Steps to create a Github pull request (git branch, etc.). Another way to show your Git username is with this git config command: git config --list which returns this output: user.name=Alvin Alexander user.email=[omitted] merge.tool=vimdiff 3) Look in your Git configuration file. Finally, you can also see your Git username in the Git configuration file in your HOME directory on Unix systems, i.e., this file: ~/.gitconfig

git config user.name
git config user.email

I believe these are the commands you are looking for.

Here is where I found them: http://alvinalexander.com/git/git-show-change-username-email-address

Setting your username in Git, How do I change my git username and password in terminal? Confirm that you have set the Git username correctly: $ git config --global user.name > Mona Lisa; Setting your Git username for a single repository. Open Terminal Terminal Git Bash. Change the current working directory to the local repository where you want to configure the name that is associated with your Git commits. Set a Git username: $ git config user.name "Mona Lisa"

git config --list git config -l will display your username and email together, along with other info

How to retrieve user info and public repos of a user? · Issue , Open TerminalTerminalGit Bash. Set a Git username: $ git config --global user.​name "Mona Lisa". Confirm that you have  Join GitHub today. GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.

Try this

git config user.name

git config command stores and gives all the information.

git config -l

This commands gives you all the required info that you want.

You can change the information using

git config --global user.name "<Your-name>"

Similarly you can change many info shown to you using -l option.

Identifying yourself to Git, From the command line: git config --global user.name "User name" git config --​global user.email user@example.com. The "User Name" part is arbitrary, but it is​  GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together. JavaScript 100.0% Use Git or checkout with SVN using the web URL. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching GitHub Desktop

While its true that git commits don't have a specific field called "username", a git repo does have users, and the users do have names. ;) If what you want is the github username, then knittl's answer is right. But since your question asked about git cli and not github, here's how you get a git user's email address using the command line:

To see a list of all users in a git repo using the git cli:

git log --format="%an %ae" | sort | uniq

To search for a specific user by name, e.g., "John":

git log --format="%an %ae" | sort | uniq | grep -i john

First-Time Git Setup, You can also change them at any time by running through the commands again. Git comes with a tool called git config that lets you get and set configuration The first thing you should do when you install Git is to set your user name and email This is important because every Git commit uses this information, and it's​  git config --global user.name "your username" git config --global user.password "your password" By that, any local git repo that you have on your machine will use that information. You can individually config for each repo by doing: open terminal at the repo folder. run the following:

How to set GitHub user.name and user.email per Repository , By default /<Users>/.gitconfig file is used for all related information during commit. [user]. name = Crunchify. email = email [at] crunchify.com. [pull] Setting your commit username and email address in Git; Set GitHub email  ~/.gitconfig or ~/.config/git/config file: Values specific personally to you, the user. You can make Git read and write to this file specifically by passing the --global option, and this affects all of the repositories you work with on your system. config file in the Git directory (that is,

API to get user/check if exists by email?, Is there any way to check if user exists on Gihub if we have email address? You can search for users by username and other criteria using the API if the same rules when displaying the links to GitHub user's profile page? In Windows OS, we can find the current logged in username from windows command line. The logged in user information is stored in environment variables. So just by printing the value in these environment variables we can get to know the login name. To know the login name of the currently logged in user we can run the below command.

Setup for HTTPS Users Using Git Credentials, For more information, see Use Git Credentials and HTTPS with AWS If you do not save them, you can copy the user name from the IAM console, but you cannot or follow the steps in the Getting Started with Git and CodeCommit tutorial. npm-user-cli . Get user info of an npm user. Install $ npm install --global npm-user-cli Usage $ npm-user --help Usage $ npm-user <username> Example $ npm-user sindresorhus Name: Sindre Sorhus Email: sindresorhus@gmail.com GitHub: sindresorhus Twitter: sindresorhus Related. npm-user - API for this module; License

Comments
  • Come on. How about stackoverflow.com/a/24051281/248616 git config --list
  • indeed @DroidChris