I have created the ssh key and added it to my gitlab account.
Then, I've made a commit:
git add .
git commit -m "w"
git push origin master
(https://prnt.sc/q7yc4q)
But as you can see my username when I committed was root
(this is because user on my laptop is root
1)How do I set the desired username let's call it batman
, so instead of root I want batman to be displayed as commit author?
2)Can I do this using only gitlab interface and without messing with my git config on my laptop? (I am asking because I have several git accounts and I need to use different accoounts for my projects)
How do I set the desired username let's call it batman, so instead of root I want batman to be displayed as commit author?
# Set the username for git commit
git config --global user.name "<your name>"
# Set the emailfor git commit
git config --global user.email "<your email address>"
... I need to use different accounts for my projects
# --local is the default so you don't have to add it
# Set the username for git commit
git config --local user.name="<your name>"
# Set the emailfor git commit
git config --local user.email="<your email address>"
git filter-branch -f --env-filter '
GIT_AUTHOR_NAME="Newname"
GIT_AUTHOR_EMAIL="newemail"
GIT_COMMITTER_NAME="Newname"
GIT_COMMITTER_EMAIL="newemail"
' HEAD
# Update the username and email as explained above
# Re-commit to update the username/email
git commit --amend --no-edit
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With