Reputation: 341
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
Upvotes: 7
Views: 7576
Reputation: 51
Old post, new answer:
You can do exactly what you are asking (understanding the latency element of GCS buckets).
1 - Mount the GCS bucket as a volume with gcsfuse
https://cloud.google.com/storage/docs/cloud-storage-fuse/overview
2 - Set that mounted volume path as a git remote (yes a local directory can be a git remote from another directory on the same machine
How to add a local repo and treat it as a remote repo
Upvotes: 0
Reputation: 67163
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.
Upvotes: 2
Reputation: 12155
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
Upvotes: 8