Rahul Sonar
Rahul Sonar

Reputation: 79

git uses root instead of my username while commit linux

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

Upvotes: 6

Views: 11634

Answers (1)

VonC
VonC

Reputation: 1329162

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

Upvotes: 12

Related Questions