我旅行,没有我的普通笔记本电脑。我需要创建一个新项目,并将其作为新的回购站点推送到我的GitHub。我的朋友,谁拥有这台笔记本电脑(我正在写这个问题)也在GitHub上做了很多东西。所以我在本地创建了项目,然后登录到GitHub并创建了远程回购。 GitHub的要我运行下面的命令,典型为所有新回购:权限被拒绝给我自己的GitHub回购
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/mygithubuser/example-app.git
git push -u origin master
当我就去做git push -u origin master
,我收到以下错误:
remote: Permission to mygithubuser/example-app.git denied to other-user.
fatal: unable to access 'https://github.com/mygithubuser/example-app.git/': The requested URL returned error: 403
...其中other-user
是我的朋友的GitHub用户名(毕竟,我正在使用他的笔记本电脑)。所以,我抬头典型的修复,并试图运行:
git remote set-url origin https://github.com/mygithubuser/example-app.git
的Git没有抱怨,所以后来我试图重新运行:
git push -u origin master
...但我得到相同的“403”错误。任何想法,我要走错了,这里的修复是什么?理想情况下,有一些魔术命令会要求我以我的典型用户身份进行身份验证?
能临时添加ssh酒馆关键看你在github上键,然后将其删除,当你给一台笔记本电脑回来吗?听起来像是我最简单的选择。 – speedingdeer
谢谢@speedingeer(+1) - 这将如何工作?我在哪里可以找到正在使用的SSH发布密钥? '〜/ .ssh/known_hosts'不包含任何GitHub引用...... – smeeb
github具有优秀的使用ssh密钥的文档。 https://help.github.com/articles/generating-an-ssh-key/ – speedingdeer