git - 试图通过命令行将项目上传到 github,但它说 PERMISSION TO [old account name] denied
问题描述
我正在尝试将项目上传到 github,所以我运行了命令
$ git push origin master
但它给了我
remmote: Permission to [repo name] denied to [old github account I used on this
laptop]
fatal: unable to access repository
解决方案
您需要首先检查使用的远程 URL:
git remote -v
如果它以 https:// 开头,您可能有一个包含错误凭据的缓存
git config credential.helper
例如,请参阅“在 Windows 中的 Git Bash 控制台中注销”:
git credential-manager reject https://github.com
在 Mac 上osxkeychain
,请参阅“从 OSX 钥匙串更新凭据”
git credential-osxkeychain erase https://github.com
然后下一次推送将触发一个弹出窗口,要求您输入用户名/密码。
如果它以 开头git@github.com:...
,您可以为旧帐户使用默认的 id_rsa 私钥。
推荐阅读
- spring-boot - 无法通过枚举过滤:org.h2.jdbc.JdbcSQLSyntaxErrorException: Column "ROLES" not found; SQL 语句
- python - 使用 Python 提取 JSON 值
- c++ - C++ - 使用父类属性
- javascript - 如何处理 React JS 中输入选择的更改值?
- perl - 在 Perl 中将文件时间转换为 GMT
- php - 用最后一个反转第一个数组元素
- python - 安装 MySQL 后 Pipinstall 无法正常工作
- python - 如何将 matplotlib 中折线图上的各个像素坐标返回到新的 Pandas DataFrame 列中?
- c# - 如果我的 TempData[ 不存在,如何将其设置为特定值
- testing - 在 neovim 中为 testcafe 设置 eslint