在openshift中使用现有应用程序中的git repo和新应用程序

时间:2014-06-26 13:19:24

标签: django git openshift

我在openshift中创建了一个使用我的一些代码的应用程序。这是一个django项目。我希望能够使用他们的REST API创建一个新应用程序,但要使新应用程序使用现有的repo作为源代码。可能吗?在我的openshift Web控制台中,在现有的应用程序部分中它提供了一个URL并要求我将其复制到git clone。网址是这种形式

ssh://a_very_large_string@appname-domain.rhcloud.com/~/git/appname.git/

我像这样使用REST API调用

curl -k -X POST https://openshift.redhat.com/broker/rest/domains/rhombus/applications --user "username:password" --data "name=client1&cartridge=python-2.7&scale=false&gear_profile=small&initial_git_url=ssh://a_ver_large_string@appname-domain.rhcloud.com/~/git/appname.git/"

但我得到的回应如下:

{"api_version":1.7,
 "data":null,
 "messages":[{"exit_code":216,"field":"initial_git_url",
              "index":null,
              "severity":"error",
              "text":"Invalid initial git URL"}
    ],
 "status":"unprocessable_entity",
 "supported_api_versions":[1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7],
 "type":null,
 "version":"1.7"}

如何获取我的git repo url以在新应用程序中使用它?

1 个答案:

答案 0 :(得分:1)

在命令行中,您可以输入rhc apps以获取有关现有应用的所有信息 - 包括git网址。

如果您想查看文档,请参阅文档中的页面:https://access.redhat.com/site/documentation/en-US/OpenShift_Online/2.0/html/User_Guide/Viewing_Applications_for_a_User.html

您可能也对cloning现有应用程序中的文章感兴趣。

StackOverflow post还包含有关在OpenShift上为新应用程序使用现有git仓库的说明。我自己还没试过,但看起来很有希望。 (相关信息在第一个答案中,但它有一些方法,所以你需要浏览才能找到它。)