CreateRepository - 创建/导入代码库

更新时间:
复制 MD 格式

创建或者导入代码库。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

调试

授权信息

当前API暂无授权信息透出。

请求语法

POST /repository/create HTTP/1.1

请求参数

名称

类型

必填

描述

示例值

accessToken

string

否

个人访问令牌。 使用阿里云 AK+SK 或使用 STS 临时授权方式不需要传该字段

f0b1e61db5961df5975a93f9129d2513

sync

boolean

否

是否同步执行创建仓库 可选值:true / false

false

createParentPath

boolean

否

是否创建父目录 可选值:true / false

true

organizationId

string

是

企业标识,也称企业 id,字符串形式,可在云效访问链接中获取,如 https://devops.aliyun.com/organization/【OrganizationId】

60de7a6852743a5162b5f957

body

object

是

请求 Body

name

string

是

代码库名称

Demo库

path

string

否

代码库路径

Demo库(与name保持同层级,name与path的值可以不同,若带上了父路径,那么需要设置createParentPath字段为true,且父路径前面不加斜杠,如 parentPath/demo)

namespaceId

integer

否

代码库父路径 id

2022

description

string

否

代码库描述

测试内容

visibilityLevel

integer

否

代码仓库可见性 0 - 私有,仅代码库成员可见 10 - 企业内公开,企业成员可见

0

importUrl

string

否

待导入代码库地址(http 协议),例如 github 平台上的代码库地址

https://github.com/a/b.git

importAccount

string

否

导入时使用的账号

codeup-test

importToken

string

否

导入时账号的 token

xxxxx

importTokenEncrypted

string

否

importToken 字段的传输格式,使用明文或 rsa 加密 可选值:text(明文) / rsa(rsa 加密)

text

importDemoProject

boolean

否

是否导入示例项目 可选值:true / false

true

avatarUrl

string

否

代码库头像地址

https://tcs-devops.aliyuncs.com/thumbnail/112afcb7a6a35c3f67f1bea827c4/w/100/h/100

readmeType

string

否

自动创建 readme 类型 EMPTY - 仅创建 README.md USER_GUIDE - 包含新手引导

枚举值:

  • USER_GUIDE :

    创建包含新手引导内容的 README.md 文件

  • EMPTY :

    仅创建空的 README.md 文件

USER_GUIDE

importRepoType

string

否

导入代码库类型 GIT - Git 库 SVN - SVN 库

GIT

initStandardService

boolean

否

初始化标准智能化服务 可选值:true / false

true

gitignoreType

string

否

gitignore 模板类型

Java

isCryptoEnabled

boolean

否

是否启用加密 可选值:true / false

false

localImportUrl

string

否

本地导入代码库的远程地址

""

返回参数

名称

类型

描述

示例值

object

返回结果

errorMessage

string

错误信息

SYSTEM_UNAUTHORIZED_ERROR

requestId

string

请求 ID

F590C9D8-E908-5B6C-95AC-56B7E8011FFA

errorCode

string

错误码

401

success

boolean

调用是否成功

true

result

object

返回详情结果

id

integer

id

2959

description

string

描述

线下测试

defaultBranch

string

默认分支

master

visibilityLevel

string

可见性。0:私有,10:内部公开

0

sshUrlToRepo

string

ssh 地址

""

httpUrlToRepo

string

http 地址

""

webUrl

string

web url

""

name

string

名称

codeupTest

nameWithNamespace

string

名称(含父路径)

codeup-test-org / test-codeup

path

string

路径

test-codeup

pathWithNamespace

string

路径(含父路径)

codeup-test-org/test-codeup

createdAt

string

创建时间,采用 ISO 8601 格式并包含时区偏移。

2022-01-14T21:08:26+08:00

lastActivityAt

string

最后活跃时间

2022-01-14T21:08:26+08:00

creatorId

integer

创建者 id

1233

namespace

object

父路径信息

id

integer

id

3194

name

string

名称

codeup

path

string

路径

codeup

ownerId

integer

归属者 id

123

createdAt

string

创建时间,采用 ISO 8601 格式并包含时区偏移。

2022-01-14T21:08:26+08:00

updatedAt

string

更新时间,采用 ISO 8601 格式并包含时区偏移。

2022-01-14T21:08:26+08:00

description

string

描述

codeup repo description

avatar

string

头像地址

""

public

boolean

公开性

true

visibilityLevel

string

可见性。0:私有,10:内部公开

0

archived

boolean

归档标识

false

avatar_url

string

代码库头像地址

""

demoProject

boolean

demo 库标识

false

Import_from_svn

boolean

从 SVN 导入

false

示例

正常返回示例

JSON格式

{
  "errorMessage": "SYSTEM_UNAUTHORIZED_ERROR",
  "requestId": "F590C9D8-E908-5B6C-95AC-56B7E8011FFA",
  "errorCode": "401",
  "success": true,
  "result": {
    "id": 2959,
    "description": "线下测试",
    "defaultBranch": "master",
    "visibilityLevel": "0",
    "sshUrlToRepo": "\"\"",
    "httpUrlToRepo": "\"\"",
    "webUrl": "\"\"",
    "name": "codeupTest",
    "nameWithNamespace": "codeup-test-org / test-codeup",
    "path": "test-codeup",
    "pathWithNamespace": "codeup-test-org/test-codeup",
    "createdAt": "2022-01-14T21:08:26+08:00",
    "lastActivityAt": "2022-01-14T21:08:26+08:00",
    "creatorId": 1233,
    "namespace": {
      "id": 3194,
      "name": "codeup",
      "path": "codeup",
      "ownerId": 123,
      "createdAt": "2022-01-14T21:08:26+08:00",
      "updatedAt": "2022-01-14T21:08:26+08:00",
      "description": "codeup repo description",
      "avatar": "\"\"",
      "public": true,
      "visibilityLevel": "0"
    },
    "archived": false,
    "avatar_url": "\"\"",
    "demoProject": false,
    "Import_from_svn": false
  }
}

错误码

访问错误中心查看更多错误码。

变更历史

更多信息,参考变更详情。