git远程操作异常:correct access rights
问题
please make sure you have the correct access rights and the repository exists.[windows]
解决方案
重新配置秘钥信息;
全文命令使用 git bash 执行;
1. 重置 git 用户的名字和邮箱
# 设置全局 git 用户名称和邮箱; git config --global user.name "yourname" git config --global user.email "xxxx@exp.com"
2. 重新生成 ssh 密钥对
# 如不设密码,直接回车到底; ssh-keygen -t rsa -c "xxxx@exp.com"
3. 删除 .ssh 文件夹下的 known_hosts
# 如涉及其他 ssh 连接,也可以通过只删除相应的行; rm -rf ~/.ssh/known_hosts
4. 拷贝公钥到托管服务
将 ~/.ssh/id_rsa.pub
文件中的内容拷贝至 github
/gitee
的 ssh 公钥设置中;
5. 尝试 ssh 到 github/gitee
这一步会重写 known_hosts
;
# 使用 git bash 执行 ssh -t git@github.com # 或 ssh -t git@gitee.com
总结
以上为个人经验,希望能给大家一个参考,也希望大家多多支持代码网。
发表评论