显示自述文件的 github 页面,而不是 index.js

Posted

技术标签:

【中文标题】显示自述文件的 github 页面,而不是 index.js【英文标题】:github pages displaying readme, not index.js 【发布时间】:2018-03-17 15:29:00 【问题描述】:

我有一个基本的 React 应用程序。没有后台。我想在 github 页面上设置它。我关注了这篇文章,两次。 https://medium.freecodecamp.org/surge-vs-github-pages-deploying-a-create-react-app-project-c0ecbf317089

Github Pages 两次都在我的公共文件夹中显示 README.md 文件而不是 index.html 文件。这是应用程序文件目录的图像。有什么想法吗?

如果重要的话,这是我在 package.json 中的内容:


  "name": "react-blog",
  "version": "0.1.0",
  "private": true,
  "homepage": "https://jackseabolt.github.io/react-blog/",
  "dependencies": 
    "react": "^16.0.0",
    "react-dom": "^16.0.0",
    "react-scripts": "1.0.14"
  ,
  "scripts": 
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject",
    "predeploy": "npm run build",
    "deploy" : "npm run build&&gh-pages -d build"
  ,
  "devDependencies": 
    "gh-pages": "^1.0.0"
  

【问题讨论】:

重复:***.com/questions/36782467/… 这并不能解决问题。这是一个反应项目,这个答案不适用。它破坏了构建 【参考方案1】:

您的问题很可能是您使用主分支作为源。在 Github 项目页面的设置选项卡中,将源更改为使用 gh-pages 分支。

见https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#step-4-ensure-your-projects-settings-use-gh-pages

【讨论】:

以上是关于显示自述文件的 github 页面,而不是 index.js的主要内容,如果未能解决你的问题,请参考以下文章

如何在我的github repo中使用pdf文件作为自述文件?

GitHub 自述文件中的 center-align shield.io

markdown 在Github自述文件中并排显示图像

Github 和 PyPi 上的自述文件

如何在我的github自述文件中显示docker pulls作为图像

使用主题的 Github 页面上的 Gif