我试着检查了几个这样的问题和答案,但仍然无法解决我的担忧。设想的情况是:
User A with Git Account A git cloned repo to freshly installed server.
Because of this, the git account that was registered on the server was User A.
(If I understood it correctly. please correct me if I am wrong in this part)
Now I would like to use User B with Git Account B as commiter/puller/pusher to the server.我尝试用以下命令更改用户和电子邮件:
git config --global user.name "userb"
git config --global user.email "userb@gmail.com"
git config --local user.name "userb"
git config --local user.email "userb@gmail.com"
git config user.name "userb"
git config user.email "userb@gmail.com"在三个不同的场合。还是无法解决我的担忧。我可以看到使用命令git config --list、git config user.name和git config user.email更新的用户和电子邮件,因此我知道值确实发生了变化。
如果这是不可能的,我也考虑删除所有帐户,并输入用户/电子邮件和密码时,拉动/推送,而不删除git历史。
发布于 2022-03-10 08:35:44
你做错了事。您正在尝试更改用于标记提交的用户名,而必须重置git用户帐户凭据。
在Linux git config --unset credential.helper下,Windows下由Windows凭据管理器删除凭据。
https://stackoverflow.com/questions/71420792
复制相似问题