如何更新我的Github Pages网站? [英] How Can I Update My Github Pages Website?

查看:595
本文介绍了如何更新我的Github Pages网站?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将我的github网站部署到a.github.io.现在,我已经在本地进行了一些更改,并希望进行更改,但我无法这样做.这是我的回购设置在Github Pages部分中所说的:

I have my github website deployed to a.github.io. Now, I have made some changes locally and want to push changes but I am unable to do so. This is what the settings of my repo says in the Github Pages section:

在我的仓库中,我看到正在显示提交.但是,该网站仍未更新.如果我在本地运行它,我会看到更改,但在实际网站上看不到.请注意,网站托管的原始帐户也不同于我提交的帐户.

In my repo, I can see that the commits are being shown. However, the website is still not updated. If I run it locally, i see the changes but not on the actual website. Note that the original account where website it hosted is also different than the one through which I am making commits.

当我通过终端转到本地存储库并运行时

When I go to my local repo through terminal and run

git config --list

我收到了两个不同帐户的两个不同电子邮件,而不是我的用户名和电子邮件.第一个user.name基本上是我托管网站的电子邮件. user.email是我通过其发送更改的电子邮件.

Instead of my username and email, I get two different emails of my two different accounts. The first user.name is basically my email for where I am hosting the website. The user.email is the email through which I am pushing changes.

user.name = ab@hotmail.com user.email=ab@gmail.com

user.name= ab@hotmail.com user.email=ab@gmail.com

这是我尝试更新网站的方式(上次推送有效,但甚至没有用):

This is how I am trying to update the website (the pushing worked last time but it's not even working rn):

git add *
git commit -m "added new picture"

结果:

On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)

Changes not staged for commit:
    deleted:    favicon.ico
    deleted:    logo192.png
    deleted:    logo512.png
    deleted:    z<

no changes added to commit

git push

结果:

 ! [rejected]          master -> master (fetch first)
error: failed to push some refs to 'https://github.com/aa
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.

然后npm run deploy

推荐答案

尝试先拉,然后再推.

git pull

如果在合并后存在合并冲突,则需要先解决它们,然后再进行合并.

If there are merge conflicts after pulling you need to solve them before pushing again.

警告:不建议使用此选项 ,但是如果您是唯一的开发人员,则可以使用强制进行提交.这将删除过去的提交,请谨慎使用.它可以更改同一项目中其他人的历史记录.

Warning: This is not recommended option, but if you are the only developer working you can use force for your commit. This will delete past commits, use it with caution.It can change history of other people on the same project.

git push -f origin master

这篇关于如何更新我的Github Pages网站?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆