git远程操作异常:correct access rights
问题
Please make sure you have the correct access rights and the repository exists.[Windows]
解决方案
重新配置秘钥信息;
全文命令使用 git bash 执行;
1. 重置 git 用户的名字和邮箱
|
1 2 3 |
# 设置全局 git 用户名称和邮箱; git config –global user.name\”yourname\” git config –global user.email\”xxxx@exp.com\” |
2. 重新生成 ssh 密钥对
|
1 2 |
# 如不设密码,直接回车到底; ssh-keygen-t rsa-C\”xxxx@exp.com\” |
3. 删除 .ssh 文件夹下的 known_hosts
|
1 2 |
# 如涉及其他 ssh 连接,也可以通过只删除相应的行; rm-rf ~/.ssh/known_hosts |
4. 拷贝公钥到托管服务
将~/.ssh/id_rsa.pub文件中的内容拷贝至GitHub/Gitee的 SSH 公钥设置中;
5. 尝试 ssh 到 GitHub/Gitee
这一步会重写known_hosts;
|
1 2 3 4 |
# 使用 git bash 执行 ssh-T git@github.com # 或 ssh-T git@gitee.com |
来源:https://www.jb51.net/program/337880u3z.htm
