问题描述:在github中使用codespaces编写代码,commit后执行Sync同步操作时报错:You don’t have permissions to push to “Name/Name of Project” on GitHub. Would you like to create a fork and push to it instead?
参考:Push to GitHub error
问题分析:受参考资料启发,主要原因没有设置SSH密钥,具体设置方法如下:
ssh-keygen -t rsa -C "your_email@example.com"
将~/.ssh/id_rsa.pub目录下的公钥放到github -> settings -> SSH and GPG keys下面,点击new SSH key,将id_rsa.pub内容粘贴进去即可。
再次提交的时候可能会出现的问题:
fatal: unable to access 'https://github.com/username/location.git/' The requested URL returned error: 403
将远程仓库的https变为ssh格式的即可
https://github.com/username/repo.git
变为:
git@github.com:[username]/[repositoryname].git
本文讲述了在GitHubCodespaces中遇到的同步错误,原因在于未设置SSH密钥。作者提供了详细步骤,包括生成SSH密钥、添加到GitHub账户以及将HTTPS仓库转换为SSH格式的过程。
753

被折叠的 条评论
为什么被折叠?



