linux - git 在提交 linux 时使用 root 而不是我的用户名

标签 linux git github

我有一台运行 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/

相关文章:

git - 使用 R 下载、修改、上传 Github Gists

linux - sed/awk/perl 格式化多个段落

linux - centos6.5的yum报错: Input/output error

linux - 你能推荐一个很好的 linux 调试 malloc 库吗?

git - jenkins 下游作业如何通过 email-ext 向上游 git 提交者发送电子邮件通知

visual-studio - GitHub Enterprise 与 Team Foundation Server (TFS)

linux - 未检测到支持 CUDA 的设备(使用 ubuntu 12.04.4 服务器)

git stash 并申请

git - 当文件中只有很小的更改时,如何避免在完整文件显示为已修改的情况下进行提交?

Git:如何使外部存储库和嵌入式存储库作为公共(public)/独立存储库工作?