如何在推送时自动部署我的git repo的子模块? [英] How can I auto-deploy my git repo's submodules on push?

查看:138
本文介绍了如何在推送时自动部署我的git repo的子模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个PHP Cartridge正常运行,除非我找不到一个直接的方式来获取OpenShift(递归)推送我的git子模块的文件/当它推动我的核心repo文件。



这似乎应该是一个超级简单和常用的用例。我可以俯瞰某些东西吗?



我可以将 ssh 加入我的服务器并手动拉,但我想要完全自动化,所以如果我在repo中更新子模块的引用,这些更改将在部署时被反映。

解决方案

好吧,我会刺一下这个额外的50分;)



这是我遵循的步骤:



)在OpenShift上创建php-5.3应用程序克隆到本地机器。

2.)在github上创建公共git存储库以用作子模块。

3 。)使用以下命令将github存储库添加到OpenShift应用程序中,确保使用https url而不是git @ url,否则当OpenShift Online尝试检出子模块时,您将收到私钥问题。 p>

  cd进入您本地克隆的opens hift应用程序目录
git子模块添加https://github.com/developercorey/some submodule.git ./directory_name
git add。
git commit -am添加子模块
git push

如果你在git push中看不到任何错误,那么一切都应该正常运行。如果您看到这样的错误

  remote:主机密钥验证失败。 
remote:fatal:无法从远程存储库读取。
remote:
remote:请确保您具有正确的访问权限
remote:并且存储库存在。

这意味着你使用git @ url而不是https url添加你的git子模块,或者你正在尝试访问一个私有存储库。现在,您可以使用 rhc ssh 命令将ssh插入到您的应用程序中,并将光盘插入到您的〜/ app-root / runtime / repo目录中,您应该看到您的子模块目录中的文件从那个存储库里面。



如果这不适合你,请让我知道你的git push的输出是什么,我们将从那里走。 / p>

I have a PHP Cartridge that is operating normally, except I can't find a straightforward way to get OpenShift to (recursively) push the files for my git submodules when/after it pushes my core repo files.

This seems like it should be a super straightforward and common use-case. Am I overlooking something?

I could probably ssh into my server and pull them manually, but I'd like to automate this completely, so that if I update the submodule's reference in my repo these changes will be reflected when I deploy.

解决方案

Ok, I'll take a stab at this for 50 extra points ;)

Here are the steps that I followed:

1.) Create php-5.3 application on OpenShift on clone to local machine.
2.) Create public git repository on github to use as the submodule.
3.) Add the github repository to the OpenShift application using the following commands, make sure that you use the https url instead of the git@ url, or you will get private key issues when OpenShift Online tries to checkout the sub-module.

 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

If you don't see any errors in your git push, then everything should have worked correctly. if you see an error like this

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.

That means you used the git@ url instead of the https url to add your git submodule, or you are trying to access a private repository. Now you can ssh into your application using the rhc ssh command and cd into your ~/app-root/runtime/repo directory and you should see your submodule directory there with the files from that repository inside.

If that doesn't work for you, please let me know what the output of your git push is and we'll go from there.

这篇关于如何在推送时自动部署我的git repo的子模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆