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?
6 Answers
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"
.

- 1,047
- 8
- 9
-
5I see credential.helper=osxkeychain when I use git config -l. how do I go on from here to see my username? – akantoword May 26 '16 at 23:51
-
1I followed this but didn't find github.com anywhere – akantoword May 26 '16 at 23:53
-
1I accessed with a token, but I can't see any information here – Christian Vincenzo Traina Feb 19 '21 at 21:42
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.

- 3,060
- 29
- 30
-
2
-
https://stackoverflow.com/a/51997218/3556531 @Houman This should help. – KeshavDulal Jun 18 '21 at 11:12
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.

- 857
- 3
- 21
- 29
-
1it says: 'grep' is not recognized as an internal or external command, operable program or batch file. what's wrong? – eqrakhattak Oct 12 '20 at 07:41
-
2
you can check your project git config using:
git config -l

- 2,247
- 3
- 15
- 32

- 784
- 7
- 10
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.

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

- 38,512
- 12
- 92
- 130