官术网_书友最值得收藏!

Cloning the application to the local machine

Every OpenShift application has a private Git repository that houses the application source code. OpenShift uses Git not only as a version control system but also to build and deploy the application using Git's action hooks. In this recipe, you will learn how to get the source code of the OpenShift application on your local machine.

Getting ready

You will need Git installed on the operating system before stepping through this recipe. For Debian-based Linux distributions, you can install Git with apt-get install git as the root. If you are on Fedora or any other Red Hat-based system, you can install Git with yum install git-core as the root. Mac and Windows users can download the Git package from the official download site at http://git-scm.com/downloads.

This recipe will use the WordPress application created in the Creating a WordPress application using the web console recipe.

How to do it…

Perform the following steps to clone the repository:

  1. Go to the Applications tab in the web console at https://openshift.redhat.com/app/console/applications and click on the application to view its details, as shown in the following screenshot:
  2. Copy the Git repository URL mentioned on the application detail web page, as shown in the following screenshot:
  3. Open a command-line terminal, go to a convenient location on your machine, and execute the git clone command. Replace the repository URL with your application Git URL:
    $ git clone ssh://52b823b34382ec52670003f6@blog-osbook.rhcloud.com/~/git/blog.git/
    

How it works…

The first and second steps helped us to locate the application Git repository URL. As discussed in the preceding section, OpenShift uses Git as revision control and a source code management system. Every application has a private Git repository. A Git repository contains all the information needed to retain and manage the revisions and history of a project. OpenShift uses the SSH transport protocol to work with Git repositories. To create a secure communication channel between the local machine and application gear, Git uses the SSH key setup discussed in the Uploading SSH keys using the web console recipe. Nobody will be able to clone your application repository unless you add their public SSH key to your account.

In step 3, you cloned the application Git repository using the clone command. The git clone command created a new Git repository based on the original application repository URL. The difference between Git and other version control systems is that Git clones the full copy of the repository, in addition to the working copy, of all the files in the repository. The clone command will create a new directory on your local filesystem with the same name as the application.

There's more…

You can also specify a different folder name with the git clone command. Suppose you want to clone the application in the myapp folder. To do this, execute the following command:

$ git clone ssh://52b823b34382ec52670003f6@blog-osbook.rhcloud.com/~/git/blog.git/ myapp

If you want to allow any of your friends or team members to clone your repository, just add their public key to your account. Follow the Uploading SSH keys using the web console recipe to upload the public SSH key. We will discuss team collaboration in detail in Chapter 2, Managing Domains.

See also

  • The Deploying your first change recipe
主站蜘蛛池模板: 巨野县| 沅江市| 射阳县| 辽宁省| 会同县| 沿河| 镇康县| 土默特左旗| 余庆县| 将乐县| 海淀区| 建阳市| 嵩明县| 米泉市| 磐石市| 资源县| 宁武县| 固镇县| 双辽市| 福建省| 凭祥市| 云龙县| 天柱县| 屏南县| 天长市| 丰台区| 紫阳县| 彰化市| 定襄县| 太谷县| 滦平县| 于田县| 会宁县| 永登县| 孟州市| 沁水县| 蒲江县| 邢台县| 合作市| 昌邑市| 东城区|