将Git仓库同步到Google Cloud [英] Syncing Git repo to Google Cloud

查看:119
本文介绍了将Git仓库同步到Google Cloud的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以假设我有一个git仓库https://github.com/jc/ 并且我有一个Google桶gs://acme-sales/的位置.

So suppose I have a git repository https://github.com/jc/ and I have a location for the google bucket gs://acme-sales/.

有没有一种方法可以编写python程序来更新github中所做的更改,并在每次运行时将其同步到Google Cloud?

Is there a way to write a python program which updates the changes which have been made in github and sync them to google cloud each time we run it?

我想我们必须使用gitpython从github链接中读取文件,但是我如何继续将文件更新到google bucket.

I suppose we have to use gitpython to read the file from github link but how do I just keep updating the files to google bucket.

推荐答案

我建议您使用 Google Cloud Build .它可以让您同步您的存储库,并使用 gsutil > ,您可以在gs://acme-sales ="nofollow noreferrer">每次提交到您的GitHub存储库:

I recommend you to use Google Cloud Build. It lets you syncing your repo and using gsutil you can automatically update your storage i.e gs://acme-sales on each commits to your GitHub repository:

steps:
- name: gcr.io/cloud-builders/gsutil
  args: ['cp', '/workspace', 'gs://acme-sales']

您可以通过连接存储库在GitHub上开始,即https://github.com/jc/<repo_name>使用以下链接访问Google Cloud Build:

You may start on GitHub by connecting your repository i.e. https://github.com/jc/<repo_name> to Google Cloud Build using the link below:

https://github.com/apps/google-cloud-build

https://github.com/apps/google-cloud-build

这篇关于将Git仓库同步到Google Cloud的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆