推送到远程GitHub存储库
我的教授希望我们使用他的github存储库作为他的课程。我创建了ssh密钥,我将私钥添加到ssh-agent并将公钥授给了教授。 后,我创建的项目文件夹,并执行下列步骤:推送到远程GitHub存储库
git init
git add *
git commit -m "Initial commit"
git remote add origin [email protected]:prof_username/repo_name.git
git push -u origin master
我得到一个权限被拒绝(错误403)。我尝试了ssh和https url。有什么问题?
如果你已经有一个仓库,你不必初始化它;只要将它复制到本地计算机:
git clone [email protected]:prof_username/repo_name.git
,你可以设置你的上游:
git branch -u origin/my_branch
[编辑] ...,检查重点是干什么用的:
ssh -vvv [email protected]
你说得对,我不需要初始化回购。但问题依然存在。 当我执行推送时的消息是: 错误:prof_username/repo_name.git被拒绝给myusername的权限。 致命:无法从远程存储库读取。 请确保您拥有正确的访问权限并存在存储库。 – retrobitguy 2015-03-19 10:06:28
@retrobitguy克隆版本库有什么问题吗?还是只有当你试图推动?也许看看这个:http://*.com/questions/13509293/git-fatal-could-not-read-from-remote-repository/20714212#20714212 – 2015-03-19 10:21:51
@LarsNielsen克隆没有问题。我的问题只是在推动。我会看链接。谢谢 – retrobitguy 2015-03-19 10:25:51
肯定你没有字面上使用'[email protected]:prof_username/repo_name.git'? – Biffen 2015-03-19 09:19:50
@Biffen我希望这只是为了隐藏实际的用户/回购股票名称。 – Holloway 2015-03-19 09:21:47
@Biffen作为Trengot说,我改变了真正的用户/回购名称的隐私。 – retrobitguy 2015-03-19 09:57:29