42

My friend set up my github for me and cloned a project onto my desktop. I want to see what is my profile name on the Github account he gave me. Is there a command to do that?

akantoword
  • 2,824
  • 8
  • 26
  • 43

6 Answers6

50

You can see the current configurations, including username, with git config -l.

You'll want to look for user.name, user.email, and github.user.

You can unset configurations using --unset, like git config user.name --unset.

You can also reset configurations using git config user.name "Your Name".

Briana Swift
  • 1,047
  • 8
  • 9
29

To see which user is accessing github via terminal you could try SSH

ssh -T git@github.com

You get the following response

Hi Keshavdulal! You've successfully authenticated, but GitHub does not provide shell access.

I have multiple ssh keys setup for different projects and it helps to know the current user.

KeshavDulal
  • 3,060
  • 29
  • 30
18
git config -l | grep user.name

This will only output username in the terminal. Similarly, for email type:

git config -l | grep user.email

Note: This will only work on mac. For windows, refer to the comments.

Gaurav
  • 857
  • 3
  • 21
  • 29
7

you can check your project git config using:

git config -l
Audwin Oyong
  • 2,247
  • 3
  • 15
  • 32
4

To add to Briana's response; use '--global' to modify the .gitconfig file and permanently change your user name. Without '--global' you would only be changing your user name for that session.

i.e.

git config --global user.name "your.user.name"

would save your user name so that you login as "your.user.name" when git starts up.

3

You can use git remote -v to list the remote repositories linked to your local clone.

You'll see GitHub repository URL which contains your GitHub user name in the middle.

Note that your GitHub user name might be different than your local username and email, which are not validated by any means (you can put whatever you want in those configuration settings).

jakub.g
  • 38,512
  • 12
  • 92
  • 130