Github页面没有更新

问题描述 投票:77回答:27

我正在与Github页面遇到一个奇怪的问题。我将一个新的提交推送到我的个人页面页面maltzj.github.io,但新文章没有出现在那里。当我在本地执行服务器时,帖子住在localhost:4000/posts/the-price-of-inconsistent-code/。然而,当我去http://maltzj.github.io/posts/the-price-of-inconsistent-code时,我得到了404.我还添加了一个新文件,它应该存在于http://maltz.github.io/test.html,但这也会引发404。

一切都在本地构建和运行我的git repo是最新的,并且github状态页面上没有关于构建问题的任何内容,所以我对这个问题的处理方式有点不知所措。如何使用我添加的新contnet更新我的页面?

作为参考,支持我的页面的repo的位置是http://github.com/maltzj/maltzj.github.io

github github-pages
27个回答
35
投票

对于其他人,还要检查帖子的日期。我刚遇到这个问题。我是UTC + 11,我很确定服务器是UTC。因此,如果我用当地时间约会我的帖子,服务器认为他们将来也不会构建它们。使用UTC避免了这个问题。

正如joao cenoura在下面的评论中所提到的:

  • 您可以通过将future: true添加到_config.yml来告诉jekyll显示“future”帖子
  • 和/或添加timezone: TIMEZONE以指定您的时区。

有关更多信息,请参阅https://jekyllrb.com/docs/configuration/


2
投票

我知道这可能听起来很简单,但要确保你在正确的分支和正确的文件中。在我的情况下,我做了一个gh页面,并尝试从主分支上的本地仓库提交。我也在更新我的文件名而不是index.html。这些是我的错误。我不得不切换到gh-pages分支并在index.html提交中更新,推送然后一切正常。


2
投票

请参阅Jerkyll故障排除网站,因为有多个错误来源:https://help.github.com/articles/troubleshooting-jekyll-builds/

在我的情况下,降价文件中的德语变音符号(“ö”)引起了问题。


1
投票

在我的情况下,在这里的一些解决方案的试验和错误之后,修复它的是将编码添加到_config文件中

encoding: UTF-8

更多故障排除选项here


1
投票

对我来说,这是一个没有正确使用.gitmodules文件的问题。我能够在我的仓库的设置选项卡中进行故障排除,在GitHub页面部分下,这表示构建问题并且有助于故障排除。


1
投票

好吧,我走到了尽头,没有什么对我有用,所以我会与你分享我为了让我的工作所做的一切。很奇怪(并且简单地)我创建了一个新的分支,使该分支成为“默认”分支并从那里推出。这对我有用,我希望它适用于那些使其达到最低点而仍未找到答案的人, 哈哈。


1
投票

我知道这只是增加了长尾列表的解决方案,但在我的情况下,我忘了在kramdown中定义_config.yaml

# Build settings
markdown: kramdown

这是因为当我从主题转换为没有主题与kramdown要求时。


1
投票

在存储库设置中,确保当前正在从gh-pages分支构建Github页面


1
投票

今天我有一个静态页面出现这个错误 - 原因实际上是GitHub Pages本身的服务失败。您可以在https://status.github.com/messages查看服务信息。


1
投票

在我的情况下,问题是因为我的存储库是私有的。在我公开之后,问题就消失了。故事的奇怪部分是我能够创建私有存储库并使用GH页面。我按照官方guidehttp://take.ms/p2SS7)做到了。它适用于大约9次提交,但是在10次它被破坏了。


0
投票

如果有人从头开始(手动)创建分支gh-pages,问题是你需要一个文件调用params.json来使它工作。

这是该文件的一个示例:

{
  "name": "nameOfProyect",
  "tagline": "name of proyect",
  "body": "### Welcome to GitHub Pages.\r\nThis automatic page generator is the easiest way to create beautiful pages for all of your projects. Author your page content here using GitHub Flavored Markdown, select a template crafted by a designer, and publish. After your page is generated, you can check out the new branch:\r\n\r\n```\r\n$ cd your_repo_root\/repo_name\r\n$ git fetch origin\r\n$ git checkout gh-pages\r\n```\r\n\r\nIf you're using the GitHub for Mac, simply sync your repository and you'll see the new branch.\r\n\r\n### Designer Templates\r\nWe've crafted some handsome templates for you to use. Go ahead and continue to layouts to browse through them. You can easily go back to edit your page before publishing. After publishing your page, you can revisit the page generator and switch to another theme. Your Page content will be preserved if it remained markdown format.\r\n\r\n### Rather Drive Stick?\r\nIf you prefer to not use the automatic generator, push a branch named `gh-pages` to your repository to create a page manually. In addition to supporting regular HTML content, GitHub Pages support Jekyll, a simple, blog aware static site generator written by our own Tom Preston-Werner. Jekyll makes it easy to create site-wide headers and footers without having to copy them across every page. It also offers intelligent blog support and other advanced templating features.\r\n\r\n### Authors and Contributors\r\nYou can @mention a GitHub username to generate a link to their profile. The resulting `<a>` element will link to the contributor's GitHub Profile. For example: In 2007, Chris Wanstrath (@defunkt), PJ Hyett (@pjhyett), and Tom Preston-Werner (@mojombo) founded GitHub.\r\n\r\n### Support or Contact\r\nHaving trouble with Pages? Check out the documentation at https:\/\/help.github.com\/pages or contact [email protected] and we\u2019ll help you sort it out.\r\n",
  "google": "",
  "note": "Don't delete this file! It's used internally to help with page regeneration."
}

25
投票

这一切都没有为我解决。解决方案是将index.html文件编辑到github网站。


0
投票

在我的情况下,它是不正确的kramdown语法。我的代码是

  {% highlight %}
  lorem lipsum
 {% endhighlight %}

显然你必须告诉kramdown语言

  {% highlight html %}
  lorem lipsum
 {% endhighlight %}

0
投票

我的Github Pages在repo的Settings选项卡下关闭了。

我不记得把它关掉了,但它就在那里,然后将它重新打开就是修复。


0
投票

加上我的两分钱:在我的情况下有两个问题(一个“pebcak”,然后是一个更有效的问题)。

我在GitHub中设置了两个电子邮件地址,我正在检查非主电子邮件中的构建错误消息(管理电子邮件:登录到GitHub,单击右上角的用户菜单,选择设置,然后选择“电子邮件”)左侧菜单 - 构建错误消息将到达主电子邮件集)。

一旦我看到我发现的错误消息,我在_config.yaml中添加了一个包含“:”字符的描述,因为这是用于分隔key,value对的字符,所以它阻止了网站的构建。


0
投票

在我的情况下,我有另一个文件与页面相同的permalink没有刷新内容。注意这一点。


0
投票

我有同样的问题,但在我的情况下,CNAME包含正确的域名。我认为问题与我以前做过的存储库重命名有关...在线名​​称与本地有所不同,虽然没有推送和在线文件更新的问题 - 现场版本没有。从本地计算机删除存储库并从GitHub再次克隆后问题得到解决。


0
投票

在我看来,github页面在一次提交时迟到了。这意味着如果您想要刷新,请添加对源,提交和推送的任何修改。

此行为仅适用于gh-pages分支和any.github.io存储库。在“docs”文件夹中,修改直接适用。


0
投票

在我的情况下,我的问题是在git push我的GitHub文件更新但没有在GitHub页面上显示我的网站。

注意:我是通过React创建网站的

同样在HTML项目中,我遇到了同样的问题,在这种情况下,我只是首先做了git pull然后git status | git add . | git commit -m"adding some content" | and git push它为我工作。

但在React project,它没有用。我在我的cmd npm run deploy上再次运行这个,然后我的React web应用程序在GitHub页面上显示。

我的建议是尝试在这篇帖子评论中显示的所有内容。因为这个问题的解决方案不是一个。


0
投票

在我的情况下,我在url留下了空的param _config.yaml。在我指定url: example.github.io后,一切都开始起作用。


9
投票

我有一个未经验证的电子邮件的问题。此更新首次发布,但在此之后失败。需要经过验证的电子邮件才能触发github页面构建。此外,部署密钥不能用于此,因为它不会触发构建。

资料来源:https://help.github.com/articles/troubleshooting-github-pages-build-failures/


9
投票

通过您的站点(example.github.io/index.html)转到index.html文件,然后重新加载页面。然后你可以回到(example.github.io)它应该更新。您可以使用master.css文件等执行相同操作。如果它不起作用,请尝试重新加载(github.com/example/example.github.io/[blob/master/]index.html),它将具有更新。


8
投票

对于未来的人发现这个:我有一个空的CNAME文件。检查您是否遇到类似问题。


6
投票

就我而言,以上解决方案都不起作用。最后我发现原因是:我的_config.yml中有“relative_permalinks”选项。最近在Jekyll 3.0中不推荐使用此选项。

请参阅:https://help.github.com/articles/removing-relative-permalinks/


3
投票

在我的情况下,碰巧是我提到了引用图像的相对路径,例如 - ./test.png似乎不允许,可能是安全问题或者是什么。无论如何,如果您已经做过类似的事情,请将其删除并将其称为test.png


3
投票

对我来说,我等了约5分钟,它已经更新了

如果有人从头开始(手动)创建分支gh-pages,问题是你需要一个文件调用params.json来使它工作。

我没有这个params.json文件,但它仍然有用......


3
投票

我有一个未封闭的<a>标签,导致构建永远悬而未决。修复解决了这个问题。理解GitHub会验证您的链接。

© www.soinside.com 2019 - 2024. All rights reserved.