Git Bash 仍在使用以前的用户名推送
Git Bash still pushing with previous username
因此,我正在尝试使用 Git bash 将存储库推送到 Github。问题是,它仍然认为我使用的是我以前使用的用户名。但是,我更改了此用户名,并使用以下命令进行了确认:
git config user.name
"CorrectName"
git config user.email
"CorrectEmail@correctdomain"
git config --global user.name
"CorrectName
git config --global user.email
"CorrectEmail@correctdomain"
但是,Github 仍然使用我以前的用户名来推送 repo。推送命令很明显:
git push origin master
remote: Permission to CorrectName/CorrectRepo.git denied to PreviousUsername
fatal: unable to access 'https://github.com/CorrectName/CorrectRepo/': The requested URL
returned error: 403
我该怎么做才能成功推送我的回购协议?
尝试删除您的遥控器并重新添加它。
git remote rm origin
git remote add origin <your origin url>
删除您的用户设置:
姓名:
$ git config --global --unset user.name
电子邮箱:
$ git config --global --unset user.email
或您所有的全局设置:
$ git config --global --unset-all
然后 set your username 在 git.
检查你是谁:
$ git config --list
好的,我让它工作了。有人帮助我并建议我 运行
git config --local credential.helper ""
命令在我的项目目录中,还有一个 git config --global --unset credential.helper
命令。凭据似乎仍在以某种方式存储,但 git 在取消设置凭据助手后推送之前要求输入用户名和密码并且推送成功。
因此,我正在尝试使用 Git bash 将存储库推送到 Github。问题是,它仍然认为我使用的是我以前使用的用户名。但是,我更改了此用户名,并使用以下命令进行了确认:
git config user.name
"CorrectName"
git config user.email
"CorrectEmail@correctdomain"
git config --global user.name
"CorrectName
git config --global user.email
"CorrectEmail@correctdomain"
但是,Github 仍然使用我以前的用户名来推送 repo。推送命令很明显:
git push origin master
remote: Permission to CorrectName/CorrectRepo.git denied to PreviousUsername
fatal: unable to access 'https://github.com/CorrectName/CorrectRepo/': The requested URL
returned error: 403
我该怎么做才能成功推送我的回购协议?
尝试删除您的遥控器并重新添加它。
git remote rm origin
git remote add origin <your origin url>
删除您的用户设置:
姓名:
$ git config --global --unset user.name
电子邮箱:
$ git config --global --unset user.email
或您所有的全局设置:
$ git config --global --unset-all
然后 set your username 在 git.
检查你是谁:
$ git config --list
好的,我让它工作了。有人帮助我并建议我 运行
git config --local credential.helper ""
命令在我的项目目录中,还有一个 git config --global --unset credential.helper
命令。凭据似乎仍在以某种方式存储,但 git 在取消设置凭据助手后推送之前要求输入用户名和密码并且推送成功。