如何发布到 github 个页面?

how to publish to github pages?

我无法理解有关发布到 github 页面的一些基本说明。有一种新方法可以发布使用 Angular Cli 制作的 Angular 项目;我正在按照 this page 对新命令 angular-cli-ghpages 的指示进行操作:

Execute angular-cli-ghpages in order to deploy the project with a build from dist folder.
Note: you have to create the dist folder in before (e.g. ng build --prod)

Usage:

ng build --prod --base-href "https://USERNAME.github.io/REPOSITORY/"
angular-cli-ghpages [OPTIONS]

我为我的项目创建了一个 dist 文件夹,然后 运行 ng 构建代码。终端显示所有块都已呈现,但我找不到 github 页面的 link。我在 github 上查看我的存储库,好像什么都没发生。这是因为我需要 cd 到特定文件夹才能执行 angular-cli-ghpages 吗?这是我的 repo,如果有任何帮助,我将不胜感激。

删除了通过 angular cli 部署到 github 的选项。

See this change

我使用命令

成功推送到 github 个页面
angular-cli-ghpages --repo=https://github.com/parthghiya/testrepo.git --name=parthghiya --email=parth.ghiya@knowarth.com --no-silent

回购 Link : https://github.com/parthghiya/testrepo

我做到了ng build --prod --base href .

我完成的步骤:

  1. 生成了我的 SSH 并添加了它。

https://help.github.com/articles/connecting-to-github-with-ssh/

  1. 执行推送命令。

编辑:

添加多个文件夹

创建与资产平行的文件夹,我创建了 2 个文件夹 Parth 和 Ghiya。然后在 angular-cli.json

中添加以下条目
"assets": [
        "assets","parth","ghiya",
        "favicon.ico",
        "manifest.json"
      ],

所以 dist 文件夹现在包含 3 个文件夹 assets、parth 和 ghiya。 然后像之前一样执行上面的push命令。

试试这个(mac):

  1. $ npm install -g angular-cli-ghpages

  2. 将您的代码推送到 github 存储库,然后 运行 在终端中执行此操作:ng build --env=prod --base-href "https://yourgithubusername.github.io/yourprojectname/" 这里 'yourprojectname' 是您的 github 存储库的名称,而不是您本地的名称 回购.

  3. 如果一切正常,那么 运行 : sudo angular-cli-ghpages 并输入密码。