Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
git在提交linux时使用root而不是我的用户名_Linux_Git_Github - Fatal编程技术网

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

git在提交linux时使用root而不是我的用户名,linux,git,github,Linux,Git,Github,我有一台运行Git的linux机器。我对回购进行了签出,并从linux commnad行进行了提交。当我执行推拉操作时,它会询问我的用户名和密码,然后显示成功 但是,在日志中,它显示由root提交。我检查了git配置,但找不到任何东西 以下是我的配置文件的值: core.repositoryformatversion=0 core.filemode=false core.bare=false core.logallrefupdates=true remote.origin.fetch=+ref

我有一台运行Git的linux机器。我对回购进行了签出,并从linux commnad行进行了提交。当我执行推拉操作时,它会询问我的用户名和密码,然后显示成功

但是,在日志中,它显示由root提交。我检查了git配置,但找不到任何东西

以下是我的配置文件的值:

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和.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>"
git提交--amend--author“New author Name”
请参阅“”中的更多内容


如果您进行了多次提交,则需要重写这些(请参见“”)

这不是编程问题。也许把它贴在别担心,欢迎在堆栈溢出上提问。嗨,VonC,谢谢你的回复。但我不是唯一一个这样做的人。其他人也会从同一个存储库中执行拉和推操作。。。在这种情况下,我无法在那里设置我的用户名。这些设置仅适用于以您的身份登录时的回购。其他人将有他们的设置注意,即使git config--list同时列出了user.name和user.email,答案中的命令可能仍然是必需的。我认为是全球的旗帜起了作用