Git用户在Mac上不会更改

时间:2018-09-16 23:44:27

标签: bash git github

上周,我的一个朋友克隆了她的Github存储库,并在我的机器上对其进行了一些工作。她使用以下bash命令更改了我计算机上的用户配置:

git config --global user.name "myFriendsUsername"
git config --global user.email "myFriendsEmail"

完成后,她使用相同的命令将用户配置更改回我的凭据,我使用

进行了验证。
git config --global user.name
git config --global user.email

返回了我的凭据。但是,今天我克隆了一个自己的存储库,进行了一些更改并尝试将其推送到原始位置,但这给了我以下错误:

remote: Permission to myUsername/myRepo.git denied to myFriendsUsername.
fatal: unable to access
'https://github.com/myUserName/myRepo.git/': The requested URL returned error: 403

我可能会忽略任何设置吗?

1 个答案:

答案 0 :(得分:1)

在将更改提交到存储库时,将使用您更改的git config设置,而不用于授权:

$ git config --global user.name "Full Name"
$ git config --global user.email "user@example.com"

当您的朋友克隆git存储库时,很可能是您计算机的凭据管理器(在Mac OS上为Keychain)保存了授权证书。

要删除此授权证书,请打开“钥匙串”,单击“所有项目”并搜索git。您将获得一些类似这样的物品:

Screenshot

删除这些证书后,Git应提示您对下一个操作重新授权。

相关问题