【问题标题】:Hosting a Repository website on Github not working?在 Github 上托管存储库网站不起作用?
【发布时间】:2016-04-26 20:43:54
【问题描述】:
git clone github.com/ubermankapil/Restaurant.git
cd repository
git checkout --orphan gh-pages
git rm -rf .
echo "My Page" > index.html
git add index.html
git commit -a -m "First pages commit"
git push origin gh-pages

我按照上述步骤(来自https://help.github.com/articles/creating-project-pages-manually/),之后我访问了存储库网址: http://ubermankapil.github.io/Restaurant/

我没有得到我网站的实际内容,而只是显示“我的页面”。 如何获取要在该存储库 url 上显示的实际内容 ?

【问题讨论】:

  • 请查看我的答案的更新,因为我相信它会解决您的问题。

标签: git github repository host


【解决方案1】:

echo "My Page" > index.html 此行将我的页面打印到 index.html 文件中 这意味着您的 index.html 文件将仅包含单词 My page。

bash 中的

">" 运算符是将输出重定向到给定文件中。 Github 页面基于 readme.md 文件而不是 index.html 工作。 使用 markdown 更新您的 readme.md。

【讨论】:

    【解决方案2】:

    在快速浏览了您的 repo 之后,似乎所有这些都没有必要。

    这是你应该做的。

    git clone github.com/ubermankapil/Restaurant.git
    cd repository
    git checkout gh-pages
    git pull
    

    这将为您提供来自gh-pages 分支的所有代码。您遵循的说明适用于从头开始的人。


    如果您已经运行了git commit,那么您需要重置。到你的原点

    git reset --hard origin/gh-pages
    

    【讨论】:

    • 还是不行。同样,它只在屏幕上显示“我的页面”。
    • 放完我的页面后你git commit了吗?
    猜你喜欢
    • 1970-01-01
    • 2012-12-10
    • 1970-01-01
    • 2018-11-08
    • 2020-05-19
    • 1970-01-01
    • 2015-10-13
    • 2017-03-05
    • 1970-01-01
    相关资源
    最近更新 更多