Angular 2 CLI-部署到github用户页面显示自述页面 [英] Angular 2 CLI - Deployment to github user page shows readme page

查看:100
本文介绍了Angular 2 CLI-部署到github用户页面显示自述页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经通过angular CLI将angular 2项目部署到了​​github用户页面上.我尝试了官方角度2 cli页面中的步骤.但是,当我尝试访问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/文件夹.如我所见,您已在其中提交了角度源代码.不幸的是,您无法将源代码保留在master分支中.

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的完整commit命令将是
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"

我已经在我的仓库中发布了相同的内容,您可以检查我的网站

I have published the same in my repo you can check my website

此外,源代码存储库是

Also, the source code repo is this

这篇关于Angular 2 CLI-部署到github用户页面显示自述页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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