Skip to content

Using more than one git repository

DanielBerman edited this page Aug 26, 2013 · 3 revisions

Introduction

The following example walks you through the steps for setting up an environment which will allow you to develop an application and push changes to more than one git repository. This scenario is a common approach, where a central repository is used for maintaining application code and where developers use phpCloud git repositories during application development.

Prerequisites

  • active phpCloud account.
  • Central git repository (e.g. github).
  • Cloned repository (see Deployment using Git tutorial).

Commands

# go into application cloned from phpCloud git repository
$ cd TestApp

# add new remote for central repository
$ zend add remote -r [email protected]:_mylogin/testapp.git
New remote called "github" was added successfully

# push changes to github remote
$ zend push application -r github
Counting objects:       40
Finding sources:        100% (40/40)
Getting sizes:          100% (8/8)
Compressing objects:    100% (3/3)
Writing objects:        100% (40/40)
Remote name: refs/heads/master, status: OK
Remote name: refs/heads/master, result: NEW

Details

Start by adding a new remote for a github repository. If it is finished successfully, a new remote is added (in this case called "github"). Now, there are two remote available: phpcloud and github. If we call push command without specifying a remote name, all changes will be committed locally and pushed to phpcloud repository. If we want to push changes to github, we need to specify a remote name using 'r' option. If status is different than OK, then there may be some conflicts. To avoid such issues, it is recommended to call 'git pull' command using external git tool.

Clone this wiki locally