Changing the GitHub username "name" (not to be confused with "Username") via the command line?

I am following the Git Immersion tutorial to get started as I am using Git for the first time.

And the very first team had my doubts. I issued the commands exactly like this:
# To login
$ ssh -T

# To change my name
$ git config --global "Joana Dine"
$ _


After all this, when I check out my GitHub account, it still has the same old name. My name has not been updated. What am I doing wrong?


source to share

2 answers

I confirm:

git config --global "Joana Dine"


This is just one of three places that Git will look to identify your commit made locally (on your workstation).
It is not related to GitHub.
It has to do with the author of the commit and the committer name for each of the commits you create.

If you want GitHub to show the specified commits as yours once you've pushed to your GitHub repository, then be sure to set and to the same values ​​as for your GitHub account.

But nothing prevents you from committing like " foo

" (git config --global "foo") and then pushing them using your GitHub credentials.
The two (commit name and GitHub credentials) are not linked at all.

"To change my name" should be understood as "To change my name locally for my new commits."

The only time GitHub will require credentials is when you pull / push the GitHub repository, in which case it will use the credentials used in $HOME/.netrc

(or %HOME\_netrc

in Windows, assuming you have defined HOME

, which is not defined by default in Windows ): see " Synchronizing with github ".



If you want to change the ones listed on github you need to rewrite the whole repo history (destructively) - see this guide

As others have said, git config

uses this information to provide an "author" field for new commits you make - it doesn't affect history.

The reason it hasn't changed anything in the past is because the author of the commit is one of the fields used to generate the hash of the commit change by modifying it.



All Articles