【问题标题】:I am on macOS I have tried clearing my old gitHub name online and locally and it just won't take locally, I still get old user name on commits我在 macOS 我尝试在线和本地清除我的旧 gitHub 名称,但它不会在本地使用,我仍然在提交时获得旧用户名
【发布时间】:2021-07-12 00:08:37
【问题描述】:

我现在正在上课正确地学习 git 和 git hub,并且我有一个旧帐户登录。我最近从 gitHub 中删除了该帐户,但似乎在我的系统上受到它的困扰。

每当我提交本地文件时,它的作者都是我不再拥有的旧名称,而当推送到 GitHub 时,该名称会继续存在。

到目前为止,我做了以下事情:

git config user.name --unset

然后将其设置为我当前的用户名。运行 git config -l 表明更改已更新。

然后我再次在本地提交,一切都恢复为旧名称。这是在测试中使用新的测试文件夹和 txt 文件。运行此 git config -l 会显示我的旧名称,而不是刚刚显示的更新名称。

我也试过了:

git credential-osxkeychain erase
host=github.com
protocol=https

在最后使用双输入。这也无济于事。作为最后的手段,我进入了钥匙串访问,并清除了用空白存储它的条目,因为它不允许我删除它并且它仍然使用我的旧名称提交。我也多次重新启动计算机。 Picture of my old name with commit and config

【问题讨论】:

  • 你可以试试git config --global user.name "Your Name"git config --global user.email "youremail@yourdomain.com"。该命令将值保存在全局配置文件 ~/.gitconfig
  • 看起来成功了,谢谢 Jatin!
  • 您是否介意我将我的评论添加为您的解决方案的答案,也许您可​​以接受,以便将来帮助其他人:)
  • 听起来不错

标签: git macos github


【解决方案1】:

原因是“您需要使用 --global 选项添加配置。全局用户名和密码与系统上所有没有特定于存储库的值的存储库上的提交相关联。

git config --global user.name "Your Name"
git config --global user.email "youremail@yourdomain.com"

该命令将值保存在全局配置文件~/.gitconfig

NOTE :-当您只想提交特定存储库时 ~/yourcode/myapp 目录。首先,切换仓库根目录:

cd ~/yourcode/myapp

git config user.name "Your Name"
git config user.email "youremail@yourdomain.com"

【讨论】:

    猜你喜欢
    • 2022-07-19
    • 2020-12-07
    • 1970-01-01
    • 1970-01-01
    • 2018-05-02
    • 1970-01-01
    • 1970-01-01
    • 2019-02-20
    • 2021-06-21
    相关资源
    最近更新 更多