我有一台运行 Git 的 Linux 机器。我检查了一个 repo,并从 linux commnad 行提交。当我进行推 pull 操作时,它会询问我的用户名和密码,然后显示成功。
但是,在日志中,它显示由 root 提交。我检查了 git config,但找不到任何东西。
这是我的配置文件的值:
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
最佳答案
您需要设置您的 user.name 和 your.email
git config --global user.name xxx
git config --global user.email xxx@mail.com
如果你只做了一次提交,你可以修改它:
git commit --amend --author "New Author Name <email@address.com>"
在“Change the author of a commit in Git”中查看更多信息。
如果您进行了多次提交,则需要重写这些内容(参见“Change commit author at one specific commit”)
关于linux - git 在提交 linux 时使用 root 而不是我的用户名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25339671/