更新时间:2025-09-28 GMT+08:00
分享

更新仓库镜像信息

功能介绍

更新仓库镜像信息

调试

您可以在API Explorer中调试该接口,支持自动认证鉴权。API Explorer可以自动生成SDK代码示例,并提供SDK代码示例调试功能。

URI

PUT /v4/repositories/{repository_id}/remote-mirror

表1 路径参数

参数

是否必选

参数类型

描述

repository_id

Integer

参数解释:

仓库的ID,通过查询用户所有仓库接口查询项目列表获取。

约束限制:

不涉及。

取值范围:

1-2147483647

请求参数

表2 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

参数解释:

用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。

约束限制:

必传。

取值范围:

字符串长度不少于1,不超过10万。

默认取值:

不涉及。

表3 请求Body参数

参数

是否必选

参数类型

描述

url

String

参数解释:

源仓地址。

取值范围:

不涉及。

约束限制:

以 http:// 或 https:// 开头。

默认取值:

不涉及。

sync_branch_type

String

参数解释:

分支同步。

取值范围:

  • all,同步全部分支。

  • default,同步默认分支。

约束限制:

不涉及。

默认取值:

不涉及。

枚举值:

  • all

  • default

mirroring_enabled

Boolean

参数解释:

开启定时同步

取值范围:

  • true,不开启定时同步。

  • false,开启定时同步。

约束限制:

不涉及。

默认取值:

不涉及。

endpoint_uuid

String

参数解释:

拓展点UUID。

取值范围:

不涉及。

约束限制:

不涉及。

默认取值:

不涉及。

响应参数

状态码:200

表4 响应Body参数

参数

参数类型

描述

url

String

参数解释:

源仓地址。

约束限制:

不涉及。

mirroring_enabled

Boolean

参数解释:

开启定时同步

取值范围:

  • true,不开启定时同步。

  • false,开启定时同步。

约束限制:

不涉及。

endpoint_uuid

String

参数解释:

拓展点UUID。

约束限制:

不涉及。

sync_branch_type

String

参数解释:

分支同步。

取值范围:

  • all,同步全部分支。

  • default,同步默认分支。

约束限制:

不涉及。

枚举值:

  • all

  • default

请求示例

更新仓库镜像信息

PUT /v4/repositories/{repository_id}/remote-mirror

{
  "url" : "https://gitee.com/mars167/git-flow-test.git",
  "sync_branch_type" : "all",
  "mirroring_enable" : true,
  "endpoint_uuid" : "dd19c11ea8464520bc8de7cbdf4418a8"
}

响应示例

状态码:200

OK

{
  "url" : "https://gitee.com/mars167/git-flow-test.git",
  "mirroring_enabled" : true,
  "endpoint_uuid" : "dd19c11ea8464520bc8de7cbdf4418a8",
  "sync_branch_type" : "all"
}

状态码

状态码

描述

200

OK

错误码

请参见错误码

相关文档