2

So I have a local repository that I've pushed to Github as a new branch, without any trouble, but the next step is to clone that same repository to Google Cloud Source Repository, also as a new branch. This is terribly confusing because I'm unfamiliar with Cloud Source Repository and the documentation doesn't really go into much details w/ regards to setting up branches.

Could someone please help me out with some instructions? Thanks in advance!

Is it easier to go through a different workflow; that is: local -> Cloud Source Repo -> Github?

Riley Hun
  • 2,541
  • 5
  • 31
  • 77
  • As far as I understand, GCP behaves just like another Git server. If the repo is already created in GCP, then this answer will work for you: https://stackoverflow.com/a/53156626/3216427 except you might do just `git push new_remote ` instead `git push --all new_remote`. – joanis Jul 23 '19 at 01:19
  • I am not using Pycharm to connect to GCP using the cloud code plugin. But now I'm getting a permissions error (Initial Git Push Failed: remote error: PERMISSION_DENIED The caller does not have permission) – Riley Hun Jul 23 '19 at 05:19
  • The permission denied error should mean you did not setup your credentials correctly for GCP. I'm not familiar with that service, but look for the getting started instructions, setting up permissions should be spelled out there. Once that is done, you should be able to push to it using the command line, just like to any other Git remote. – joanis Jul 23 '19 at 11:59

1 Answers1

2

You can mirror your GitHub repositories in Cloud Source Repositories. With the following steps, commits that you push to the GitHub repository are mirrored into your Cloud Source Repository.

You can follow the steps that I write you down, but first, don't forget to enable Cloud Source Repositories API :

  1. Go to Open Cloud Source Repositories
  2. Click Add Repository
  3. Connect external repository and Continue
  4. Select your project for the repository or create a new one
  5. Select GitHub

Once you do this, you will proceed to connect to GitHub, authorizing Google Cloud Platform to have read access to the repository. To do it, you should follow these steps:

  1. Click Connect to GitHub
  2. Sign in with your GitHub account
  3. Click Authorize GoogleCloudPlatform
  4. Select the repository that you would like to mirror
  5. Connect Selected Repository

Here you have the documentation link about mirroring a GitHub repository, in case you need more detailed information.

Hope this is what you are looking for!

ericcco
  • 741
  • 3
  • 15