如何在推送时自动部署git repo的子模块?

默里·史密斯

我有一个运行正常的PHP弹药筒,除了找不到一个简单的方法来使OpenShift在推送核心回购文件时(递归)为git子模块推送文件。

这似乎应该是一个非常简单直接的通用用例。我在俯视什么吗?

我可能可以ssh进入服务器并手动将其拉出,但是我想完全自动执行此操作,因此,如果我在回购中更新子模块的引用,则这些更改将在部署时反映出来。

用户名

好吧,我会为此加点50分;)

这是我遵循的步骤:

1.)在克隆到本地计算机的OpenShift上创建php-5.3应用程序。
2.)在github上创建公共git存储库以用作子模块。
3.)使用以下命令将github存储库添加到OpenShift应用程序中,确保您使用https网址而不是git @网址,否则当OpenShift Online尝试检出子模块时会出现私钥问题。

 cd into your locally cloned openshift application directory  
 git submodule add https://github.com/developercorey/somesubmodule.git ./directory_name
 git add .
 git commit -am "adding a submodule"
 git push

如果您在git push中没有看到任何错误,则说明一切正常。如果看到这样的错误

remote: Host key verification failed.
remote: fatal: Could not read from remote repository.
remote: 
remote: Please make sure you have the correct access rights
remote: and the repository exists.

这意味着您使用git @ url而非https url添加了git子模块,或者您试图访问私有存储库。现在,您可以使用rhc ssh命令ssh进入您的应用程序,使用cd进入〜/ app-root / runtime / repo目录,您应该在其中看到子模块目录,其中包含该存储库中的文件。

如果这对您不起作用,请告诉我git push的输出是什么,我们将从那里开始。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章