【问题标题】:Deploy to Openshift webapp created with Yeoman generator-webapp部署到使用 Yeoman generator-webapp 创建的 Openshift webapp
【发布时间】:2014-12-26 05:25:18
【问题描述】:

如何将使用 Yeoman generator-webapp 创建的 webapp 部署到 OpenShift?

generator-angular-fullstack 是部署到 OpenShift 的绝佳选择。

不幸的是 generator-webapp 没有这样的选项,并且 OpenShift 给出的所有示例都表明我需要从 Openshift 存储库 git clone 到我的本地主机。

【问题讨论】:

    标签: git openshift yeoman


    【解决方案1】:

    我已经找到了一种方法。

    阅读 yeoman 的文档,我找到了关于 deploying 的帮助,其中提到了 git-contrib-subtree 的使用(我在安装它时遇到了困难,因为 make install 我的 git 路径有问题)。

    然后当我第一次尝试推送子树 /dist 时,它会抛出错误:

    error: failed to push some refs to '<file>'    
    hint: Updates were rejected because the remote contains work that you do    
    hint: not have locally. This is usually caused by another repository pushing    
    hint: to the same ref. You may want to first merge the remote changes (e.g.,    
    hint: 'git pull') before pushing again.    
    

    我试图强制--forcegit subtree 无法识别此选项,解决方法是执行nested git

    git push origin `git subtree split --prefix dist  master`:master --force
    

    一旦我强制推送,我就可以正常运行了:

    git subtree push --prefix dist origin master
    

    因为我的项目还包含 nodeJS,所以我不得不将 OpenShift 原始代码附带的 server.js 复制到我的 app 文件夹中,并将其用作我的节点项目的模板(注意 @ 行987654334@ 已弃用)。 我还修改了Gruntfile.js 以合并server.js 并启动node

    【讨论】: