我可以使用我的现有git回购与openshift? [英] Can I use my existing git repo with openshift?

查看:75
本文介绍了我可以使用我的现有git回购与openshift?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只有在openshift上有git repo才有必要?我已经有bitbucket / github git repo,并且宁愿只推送那里。或者为了简化,我只在github上推送,但是当我想部署时,我会使用openshift做些事情吗?我可以简单地挂钩它,以便openshift获得暗示吗?



我确实检查了这个,但它让我感到困惑:它是在谈论合并退出还是新的(openshift)git?

解决方案

我的印象是你不习惯使用git。我建议你进入git,充分了解如何将代码推送到openshift。不过,让我试着向你解释所涉及的步骤:
正如你一般使用git所做的一样,这里选择的方法是将你的其他git repo(例如bitbucket)克隆到本地机器上: p>

git clone< bitbucket-repo-url>



您的本地克隆然后将您的其他回购(bitbucket等)作为远程回购。你的远程仓库与别名origin(git使用的默认别名,如果你克隆)一起存储。然后,您将openshift repo添加为远程克隆。你这样做的同时明确使用别名来添加远程仓库 - 我在这里使用openshift作为别名:

git remote add openshift -f< openshift-git-repo-url>



为了能够从你本地的git仓库openshift你首先必须合并你的openshift repo和你的本地bitbucket克隆。你可以通过在本地发行:

git merge openshift / master -s递归-X我们



使用这个命令,你告诉git将openshift git仓库中的master分支与你本地的git仓库合并。您告诉它使用递归合并策略合并,并在出现冲突时选择您的(我们的)版本。



合并执行后,您已准备好把你的git repo推到openshift。您可以这样做:

git push openshift HEAD



您告诉git将您的本地代码推送到名为openshift的远程仓库的HEAD分支(我们将openshift git仓库存储的别名,以及更多段落中的某些段落)。

顺便说一句。我写了一个jboss工具博客,它展示了几个月前如何使用openshift-java-client: https://community.jboss.org/wiki/Enable-openshift-ciFullExampleUsingOpenshift-java-client 。您将在最后一段中看到上述步骤我们快到了。


Is it necessary to have git repo on openshift only? I already have bitbucket / github git repo and would prefer to push there only. Can I simply hook into it so that openshift gets intimation ?

Or for simplification, I push only at github, but when I want to deploy, I do something with openshift?

I did check this but it confused me: it's talking about merging exiting and new (openshift) git ?

解决方案

I have the impression that you're not used to use git enough yet. I'd advise you to get into git to fully understand how to push your code to openshift. Nevertheless let me try to explain you the steps involved: As you'd do with git in general, the approach to choose here is to clone your other git repo (ex. on bitbucket) to your local machine:

git clone <bitbucket-repo-url>

Your local clone has then your other repo (bitbucket etc.) as remote repo. Your remote repo is stored with the alias "origin" (the default alias used by git if you clone). You then add the openshift repo as remote to your clone. You do that while explicitly using an alias for the remote repo you add - I'm using "openshift" as alias here:

git remote add openshift -f <openshift-git-repo-url>

In order to then be able to push the code from your local git repo to openshift you first have to merge your openshift repo with your local bitbucket clone. You do that by issuing locally:

git merge openshift/master -s recursive -X ours

With this command you tell git to merge the master branch in the openshift git repo with your local git repo. You tell it to merge using the recursive merging strategy and to choose your ("ours") version when there are conflicts.

Once the merge is executed you're ready to push your git repo to openshift. You do that by doing:

git push openshift HEAD

You tell git to push your local code to the HEAD branch on the remote repo called "openshift" (the alias we stored the openshift git repo at, some paragraphs further up).

btw. I wrote a jboss tools blog which was demonstrating how to use the openshift-java-client some months ago: https://community.jboss.org/wiki/Enable-openshift-ciFullExampleUsingOpenshift-java-client . You'll spot the above steps in the last paragraph "We're almost there".

这篇关于我可以使用我的现有git回购与openshift?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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