- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我已经用 AngularJS 创建了一个静态站点,现在想将它作为 Github 页面上传。我已按照此处的所有说明进行操作
https://help.github.com/articles/creating-project-pages-manually
我可以创建一个名为 gh-pages
的新分支和 git push origin gh-pages
我所有的内容都很好。当我去我的仓库时,我看到了新的 gh-pages
像这样将所有文件分支到那里
https://github.com/siddhion/maxmythic_angular/tree/gh-pages
问题是当我尝试在 http://siddhion.github.io/maxmythic_angular/ 查看我的网站时我只是得到一个 404 页面。我认为问题在于我没有 index.html
在顶级目录中。它实际上位于app
目录。我的目录结构看起来像它的样子,因为我是通过 Yeoman 创建的。我假设我需要顶级的所有文件。或者也许我在这个假设中错了?
如何让我的 AngularJS 静态站点正确显示?
更新
我按照斯蒂芬提供的步骤进行了操作。我到了第 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 subtree push --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).
subtree push
因为我是 git 的新手,不知道什么会被破坏。我的意思是,我目前没有
gh-pages
在我的 maxmythic_angular 分支
origin
远程所以我不担心,但我有我的
master
,
gh-pages-old
和
gh-pages-v1
那里的分支机构。如果我运行
git subtree push --prefix dist origin gh-pages
,它们会被摧毁吗? ?
最佳答案
有一个deployment guide在 Yeoman 的网站上,了解如何使用 git subtree
部署到 gh-pages 分支。 .
从指南...
当您运行 grunt build 时,它会在可以部署的 dist 目录中生成一个完全优化的应用程序版本。
部署 dist 目录的推荐方式是使用 git subtree。
git add dist && git commit -m "Initial dist subtree commit"
git subtree push --prefix dist origin gh-pages
git subtree push --prefix dist origin gh-pages
关于angularjs - 如何将我的 AngularJS 静态站点上传到 Github Pages?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17643381/
我是一名优秀的程序员,十分优秀!