如何使用 REST API 将 Bitbucket 存储库连接到 Google 云源存储库

How to Connect Bitbucket repos to Google cloud source repository using REST API

我正在使用云构建服务进行持续集成,并且能够在 google 云源存储库中创建 bitbucket 镜像,但是,我想将所有 bitbucket 存储库镜像到云源存储库。 我不想一直手动创建。

我看到了[Rest API to Create mirror repos][1] 这个。但不知道该怎么做。

下面是创建镜像仓库时必须传递的正文。请帮助我。

{
  "name": "",
  "size": 0,
  "url": "",
  "mirrorConfig": {
    "deployKeyId": "",
    "url": "",
    "webhookId": ""
  },
  "pubsubConfigs": {}
}```


  [1]: https://cloud.google.com/source-repositories/docs/reference/rest/v1/projects.repos/create

嘿@SHASHIKUMARKL 已经使用端点 /v1/projects.repos/create 使用其余部分 api 验证了你的想法,但是,它不会工作,因为 mirrorConfig 属性 is read only field. so you cannot change it to automate the process of mirroring between GCP and BitBucket. This endpoint /v1/projects.repos/create is intended to create repos not to mirror them. The only way to mirror repos is one by one following this guide