Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git uses root instead of my username while commit linux

Tags:

git

linux

github

I have a linux machine running with Git. I did a checkout of a repo and I do commits from the linux commnad line. When I do push and pull operations, it asks me my username and password, and then it shows success.

However, in logs, it shows committed by root. I checked in git config, and I could not find anything.

Here are the values of my config file:

core.repositoryformatversion=0 
core.filemode=false
core.bare=false
core.logallrefupdates=true
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
remote.origin.url=https://github.com/my-username/RepositoryName.git
branch.stage.remote=origin
branch.stage.merge=refs/heads/stage
like image 207
Rahul Sonar Avatar asked Aug 16 '14 11:08

Rahul Sonar


1 Answers

You need to set your user.name and your.email

git config --global user.name xxx
git config --global user.email [email protected]

If you only did one commit, you can amend it:

git commit --amend --author "New Author Name <[email protected]>"

See more at "Change the author of a commit in Git".

If you did several commit, you would need to rewrite those (see "Change commit author at one specific commit")

like image 184
VonC Avatar answered Nov 04 '22 13:11

VonC