https://help.github.com/articles/creating-project-pages-manually
我可以创建一个名为gh-pages和git push origin gh-pages的新分支,我的所有内容都很好.当我去我的回购我看到新的gh页面分支与所有的文件在那里像这样
https://github.com/siddhion/maxmythic_angular/tree/gh-pages
问题是,当我尝试在http://siddhion.github.io/maxmythic_angular/查看我的网站时,我只需要一个404页面.我假设问题是我没有我的index.html在顶级目录.它实际上位于应用程序目录中.我的目录结构看起来是因为我通过Yeoman创建它的方式.我认为我需要我顶级的所有文件.或者也许我错了这个假设?
如何让我的AngularJS静态网站正常显示?
UPDATE
我遵循史蒂芬提供的步骤.我得到第3步,我有一个错误:
$git subtree push --prefix dist origin gh-pages git push using: origin gh-pages To git@github.com:siddhion/maxmythic_angular.git ! [rejected] 5db3233d7c0822eedc5500409ce6a2d4b73ad427 -> gh-pages (non-fast-forward) error: Failed to push some refs to 'git@github.com:siddhion/maxmythic_angular.git' hint: Updates were rejected because a pushed branch tip is behind its remote hint: counterpart. Check out this branch and merge the remote changes hint: (e.g. 'git pull') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
然后我试过
$git pull origin master From github.com:siddhion/maxmythic_angular * branch master -> FETCH_HEAD Already up-to-date.
然后再尝试git子树再次推送–prefix dist origin gh-pages,但得到相同的错误.
You might get an error like this Updates were rejected because the tip
of your current branch is behind. You can solve this by force pushing
to the remote (be careful though,it will destroy whatever is already
there).
我很担心强制子树推送,因为我是新来的git一般,不知道会被毁灭.我的意思是说,目前我的maxmythic_angular原始遥控器上没有一个gh页面分支,所以我不担心,但是我有我的主,gh-page-old和gh-pages-v1分支.如果我运行git subtree push –prefix dist origin gh-pages,它们会被销毁吗?
从指南…
当您运行grunt构建时,它会在可以部署的dist目录中生成一个完全优化的应用程序版本.
部署dist目录的推荐方法是使用git子树.
>从.gitignore文件中删除dist目录.
>将dist目录添加到您的存储库,并将其提交到项目中.
git add dist&& git commit -m“初始dist子树提交”
>一旦dist目录是您的项目的一部分,我们可以使用git子树在不同的分支上设置单独的存储库.注意:前缀必须是dist目录的相对路径.这是假设dist在你的根目录.
git subtree push –prefix dist origin gh-pages
>现在,您可以在默认(主)分支中提交到整个存储库,并且每当您要部署可以运行的dist目录时:
git subtree push –prefix dist origin gh-pages