Angular 2 CLI - 部署到 github 用户页面显示自述页面 [英] Angular 2 CLI - Deployment to github user page shows readme page
问题描述
我已通过 angular CLI 将我的 angular 2 项目部署到我的 github 用户页面.我尝试了 official angular 2 cli page 中的步骤.但是,当我尝试访问 github url 时,它会显示自述文件的内容.用户页面和用户页面/baseUrl 的作用相同.
I have deployed my angular 2 project to my github user page via angular CLI. I tried out the steps from official angular 2 cli page. However when I try to access the github url it shows the contents of readme file. Both the user page and user-page/baseUrl does the same.
我使用了在本地环境中工作的路由.我不确定是否应该修改生产环境变量或 baseUrl.
I have used routing which works in the local environment. I’m not sure if I should modify the production environment variables or baseUrl.
存储库链接:https://github.com/nirmalks/nirmalks.github.io
推荐答案
你应该提交由 ng build
生成的 dist/文件夹在你的 repo 的 master 分支中.正如我所看到的,您在那里提交了 angular 源代码.不幸的是,您无法将源代码保存在主分支中.
You should commit dist/ folder generated by ng build
in master branch of your repo. As I can see you have your angular source code commited there. Unfortunatey you cannot keep your source code in your master branch.
使用 ngh 的完整提交命令将是 ng build --prod --base-href="YOUR_GITHUB_USER_NAME.github.io"
然后 ngh --message="MESSAGE" --branch="master"
the complete commit command with ngh will be ng build --prod --base-href="YOUR_GITHUB_USER_NAME.github.io"
and then
ngh --message="MESSAGE" --branch="master"
我已经在我的 repo 中发布了相同的内容,您可以查看 我的网站
I have published the same in my repo you can check my website
另外,源代码仓库是this
这篇关于Angular 2 CLI - 部署到 github 用户页面显示自述页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!