git push提示 Permission to user1/xxx.git denied to other user2.

因为某些不知名的骚操作,我在git push自己的代码时提示下面这样的报错信息

remote: Permission to marsggbo/xxx.git denied to 其他用户名.
fatal: unable to access 'https://github.com/marsggbo/xxx.git/': The requested URL returned error: 403

试了一圈办法才找到有用的。方法很简单,亲测在linux系统上有效:

git config --global --unset credential.helper

参考 https://stackoverflow.com/questions/21615431/git-pushes-with-wrong-user-from-terminal

另外也可以试试下面的方法,就是把用户cache删了

git credential-cache exit

参考https://stackoverflow.com/questions/15381198/remove-credentials-from-git

微信公众号:AutoML机器学习
MARSGGBO原创
如有意合作或学术讨论欢迎私戳联系~
邮箱:marsggbo@foxmail.com

原文地址:https://www.cnblogs.com/marsggbo/p/15795248.html