简体   繁体   中英

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

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

git config --global user.name xxx
git config --global user.email xxx@mail.com

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

git commit --amend --author "New Author Name <email@address.com>"

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM