Thursday, May 12, 2016

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

How to show your Git username

There are several ways to show your Git username. One way is with the "git config" command, like this:
git config user.name
which in my case returns:
Alvin Alexander
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

"committer email address" "ERROR: does not match your user account"

1. $ git log 
- to check which email address in your last commit.
For example:
commit 0ef1fea4d19145fc3257c688313da102020e3778
Author: yourusername <yourWRONGemail@address>
Date:   ....

2. if your email address is not in the list then $ git config user.email <your email>

3. $ git commit --amend --reset-author
- to reset your email

4. $git log
- to check again for sure
For example:
commit 0ef1fea4d19145fc3257c688313da102020e3778
Author: yourusername <yourRIGHTemail@address>
Date:   ....

"ERROR: missing Change-Id in commit message footer "

remote: ERROR: missing Change-Id in commit message footer
remote:
remote: Hint: To automatically insert Change-Id, install the hook:
remote: curl -Lo `git rev-parse --git-dir`/hooks/commit-msg
https://gerrit-review.googlesource.com/tools/hooks/commit-msg ; chmod +x
`git rev-parse --git-dir`/hooks/commit-msg
remote: And then amend the commit:
remote: git commit --amend

Solution

1. Install Hook
$ gitdir=$(git rev-parse --git-dir); scp -p -P 29418 YOURUSERNAME@gitsrv:hooks/commit-msg ${gitdir}/hooks/

2. Update Change-Id
$ git commit --amend


Source: http://alvinalexander.com/git/git-show-change-username-email-address

0 comments:

Post a Comment