Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sync github repository with google cloud storage bucket

Is it possible to sync a GitHub repository with a google cloud storage bucket, so that I can edit the repository on GitHub and it automatically updates the bucket with the changes. I have already tried the google cloud platform source code tools, but I couldn't find any way to update my bucket based on the source code.

Thanks

like image 236
Alex Avatar asked Apr 25 '15 00:04

Alex


People also ask

How do I use Google Cloud Shell on GitHub?

Open a github repository in the Cloud Shell The trick here is to just call the following URL: https://console.cloud.google.com/cloudshell/open with the following parameters: git_repo : this is the URL to your github repository. open_in_editor : this would be the file you want to open in the editor.

How do I upload a directory bucket to GCP?

In the Google Cloud console, go to the Cloud Storage Buckets page. Navigate to the bucket. Click on Create folder to create an empty new folder, or Upload folder to upload an existing folder.


2 Answers

There's no direct way to synchronize between a git repo and GCS. However, if you can tolerate some delay between when you update GitHub and when the changes show up in your bucket, you could create a Google Compute Engine instance and clone your git repo to the local file system there, and then set up a cron job on that instance that periodically does a git pull from your GitHub repo and then runs gsutil rsync to update your GCS bucket from there. Make sure to exclude the .git files from the rsync command, for example by running a command like:

gsutil rsync -rd -x \.git . gs://your-bucket
like image 72
Mike Schwartz Avatar answered Oct 16 '22 16:10

Mike Schwartz


You can use git annex with GCS. The last time I tried it was 2013, but it worked flawlessly then. You can see my example of how to use Google Cloud Storage with git-annex.

like image 2
jterrace Avatar answered Oct 16 '22 15:10

jterrace