Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use username as author instead of real name in GitHub?

Tags:

git

github

When doing things via the web interface of GitHub such as merging pull requests or working on gh-pages, the author of the commit is:

real name <email@address>

but I would like it to be:

username <email@address>

Is there a way to change this?

When working on my local repo and push from here, everything is as expected.

Edit

Here are some simple steps to reproduce the issue:

  • create a new repo and mark the checkbox to generate the README.md file (this creates a commit)
  • clone the repo
  • in your local repo run $ git log and notice that the real name was used for the commit done in GitHub, and not the username

Here is a test repo (I will delete it again later): https://github.com/puce77/test

Edit 2

Or is it recommended to use the real name? For what reason? I think the username is unique but the real name might be not. Also real names change more likely (eg. marriage) than usernames.

like image 782
Puce Avatar asked Jun 02 '15 18:06

Puce


People also ask

Should you use your real name as a username on GitHub?

You should use your real name. My lab has a private GitHub group for internal stuff, as well as a few open public-facing projects. Everyone in our group uses their real names or some transparent abbreviation (like jsmith ) or one that matches their university email/login ID.


1 Answers

Your question:

How to use username as author instead of real name in GitHub?

You are looking for a bad practice.

Answer:

Manually way

# For global configuration on your PC.
git config --global user.name "your_username"

# For local configuration on your client repository
git config --global user.name "your_username"

(this is bad practice)

Original best practice,

# For global configuration on your PC.
git config --global user.name "Your fullname"

# For local configuration on your client repository
git config --global user.name "Your fullname"

Automatic way: No solution existing, and Git or GitHub don't recommend this, (a simple logic, when GitHub has email address, GitHub can inferring according account's username.

Find your information: Let's type command

git config --list

you will see, the Git designers didn't recommend, or design an information field for username, just user.name

like image 67
Do Nhu Vy Avatar answered Sep 20 '22 09:09

Do Nhu Vy