拒绝user2的远程权限

joj*_*kim 4 git github github-for-mac

我创建了新帐户“ kim2”,但是当我用“ kim2”推送它时,出现
以下错误:

kim-computer:Kaggle-A-Z kim2$ git push kim2 master
remote: Permission to  kim2/Kaggle-A-Z.git denied to kim1.
fatal: unable to access 'https://github.com/kim/Kaggle-A-Z.git/': 
The requested URL returned error: 403
Run Code Online (Sandbox Code Playgroud)

我将全局user.name和全局更改user.email为新的用户ID

我正在使用HTTPS而不是SSH。
有什么办法吗?

Nir*_*han 5

我在Mac上也遇到了同样的问题,希望对Mac用户有所帮助。

  1. 打开钥匙串访问应用程序。
  2. 搜索github.com
  3. 删除其他用户的信息

问题是Mac尝试缓存用户名,因此我的帐户尝试使用以前的凭据进行提交。


jac*_*uan 0

通过编辑 ~/.gitconfig 编辑全局 user.name 和全局 user.email

[user] 
    email = your-email@xxx.com
    name = yourname
Run Code Online (Sandbox Code Playgroud)

或者

git config --global user.name "yourname"
git config --global user.email "your-email@xxx.com"
Run Code Online (Sandbox Code Playgroud)

由于您使用的是 HTTPS 而不是 SSH,因此无需担心权限问题。

由于您已通过 kim2 提交了一些补丁,因此您应该更改此提交:

git commit --amend --author="author <your-email@xxx.com>"
Run Code Online (Sandbox Code Playgroud)