Delete username from a Git repository

冷暖自知 提交于 2019-12-18 14:05:32

问题


I am getting this warning when I try to set my user name in Tower:

warning: user.name has multiple values

I have checked in a terminal window and found that I have three usernames:

macmini:HiBye shannoga$ git config --get-all user.name
Shani
shani
shani

How can I delete two of the user names?


回答1:


Use git config -e and you should see something like:

[user]
    name = Shani
    name = shani
    name = shani

Delete the lines you don't want.




回答2:


This worked for me on my Mac:

git config --global --unset-all user.name



回答3:


If you want to replace the wrong ones with the proper one:

git config --global --replace-all user.name "FName LName"

same applies for user mail:

git config --global --replace-all user.mail "mail-id@domain.com"



回答4:


Note: with git1.8.1rc1 (December 2012), the logic is different;

"git config --get" used to diagnose presence of multiple definitions of the same variable in the same configuration file as an error, but it now applies the "last one wins" rule used by the internal configuration logic.

Strictly speaking, this may be an API regression but it is expected that nobody will notice it in practice.




回答5:


If updating email address and password in your config file didn't help then probably you might be using this account with your machine for the first time. Generating and assosiating the pass phrase key with your account helps.

Reference :

https://help.github.com/en/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent https://kbroman.org/github_tutorial/pages/init.html

Cheers !



来源:https://stackoverflow.com/questions/6243407/delete-username-from-a-git-repository

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!