Wednesday, March 30, 2016

Possible way to add multiple git repositories in the same Google cloud project

Leave a Comment

Is there a way to add multiple git repositories in the same Google cloud project?

5 Answers

Answers 1

There is no way of doing this as of today. Every project can only have one remote repository.

Answers 2

It's definitely possible to have multiple local repositories that correspond with the same remote Google cloud repository.

The official documentation describes the following procedure for how to use a Cloud Source Repository as a remote for a local Git repository :

Create a local Git repository

Now, create a repository in your environment using the Git command line tool and pull the source files for a sample application into the repository. If you have real-world application files, you can use these instead.

$ cd $HOME $ git init my-project $ cd my-project $ git pull https://github.com/GoogleCloudPlatform/appengine-helloworld-python 

Add the Cloud Source Repository as a remote

Authenticate with Google Cloud Platform and add the Cloud Source Repository as a Git remote.

On Linux or Mac OS X:

$ gcloud auth login $ git config credential.helper gcloud.sh $ git remote add google https://source.developers.google.com/p/<project-id>/ 

On Windows:

$ gcloud auth login $ git config credential.helper gcloud.cmd $ git remote add google https://source.developers.google.com/p/<project-id>/ 

The credential helper scripts provide the information needed by Git to connect securely to the Cloud Source Repository using your Google account credentials. You don't need to perform any additional configuration steps (for example, uploading ssh keys) to establish this secure connection.

Note that the gcloud command must be in your $PATH for the credential helper scripts to work.

It also explains how to create a local git by cloning a Cloud Source repository :

Clone a Cloud Source Repository

Alternatively, you can create a new local Git repository by cloning the contents of an existing Cloud Source Repository:

$ gcloud init $ gcloud source repos clone default <local-directory> $ cd <local-directory> 

The gcloud source repos clone command adds the Cloud Source Repository as a remote named origin and clones it into a local Git repository located in <local-directory>.

Answers 3

Git submodule should do the trick. Add git repositories as submodules.

See

Answers 4

You currently cannot do this. We know this is a useful feature, and we're working hard on it. Stay tuned!

Answers 5

No, there isn't, but you can use Git subtree merges to add multiple "subrepositories" as folders in your main repository, which will do the trick.

See details here https://help.github.com/articles/about-git-subtree-merges/

(There are also submodules as @Shishir stated, but as I understand they are only set for your current local clone and won't be included in checkouts/clones done by others, so I think submodules won't work).

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment