目标:当我执行git push -u origin master时,我希望我的本地PC推送到GitHub而不是BitBucket。
背景:我在我的苹果电脑上设置了BitBucket作为默认网站来推送代码。但是我决定为了一个新的项目切换到GitHub。下面是我得到的命令和错误:
命令:
cd proj1
git init
echo "# tmp" >> README.md
git add README.md
git commit -m "first commit"
git remote add origin git@github.com:myusername/proj1.git
git push -u origin master错误:
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.提前感谢您的帮助。
发布于 2019-03-29 22:57:31
如果此项目之前已连接到BitBucket,则可能需要编辑现有的git文件,以确保指向的是GitHub而不是BitBucket。如果不是这样,请确保您已设置凭据,以表明您有权访问GitHub上的帐户/存储库。这里有一个关于如何做到这一点的链接。查看git config命令。https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration
https://stackoverflow.com/questions/55400451
复制相似问题