无法推送到github-pages

时间:2017-05-05 05:49:45

标签: git github github-pages

我们说我在GitHub页面上有一个网站。我们称之为MyFirstSite网站。现在,我正在尝试在新存储库中创建一个 new 网站。该网站名为MyNewSite。在为MyNewSite添加和提交文件后,我尝试将更改推送到gh-pages分支,但收到了此响应:

To http://github.com/Jaklabs/MyFirstSite
! [rejected]        gh-pages -> gh-pages (fetch first)
error: failed to push some refs to 'http://github.com/Jaklabs/MyFirstSite'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

好像它试图将文件推送到我的其他存储库而不是我尝试使用的存储库。我对Git很新。这可能是一个非常简单的解决方案,但是有人可以为我指出它吗?

1 个答案:

答案 0 :(得分:0)

您的遥控器配置不正确,请尝试通过 -

删除旧的远程网址
git remote rm MyFirstSite

并按

添加新的遥控器

git remote add origin YOUR_REPO_URL

您可以从github上的repo YOUR_REPO_URL按钮获取clone or download

运行git remote -v,它应显示类似git@github.com:USERNAME/REPO_NAME.git

的内容

现在,您可以推送您的更改。