Git - Update My Git Credentials

更新用户的 Git 凭据配置详细信息。
工作区中的每个用户都有自己的已配置的 Git 凭据。 可以使用 “获取我的 Git 凭据 API”来获取 Git 凭据配置。

若要获取连接 ID,请参阅 Automate Git 集成

权限

调用方必须具有 参与者 或更高版本的工作区角色。

对于配置的连接 Git 凭据,调用方必须具有连接的权限。

所需的委派范围

Workspace.ReadWrite.All

Microsoft Entra 支持的标识

此 API 支持本节中列出的Microsoft 标识

身份 支持
用户 是的
服务主体托管标识 仅当 Git 提供程序为 GitHub 时才受支持

接口

PATCH https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/git/myGitCredentials

URI 参数

名称 必需 类型 说明
workspaceId
path True

string (uuid)

工作区 ID。

请求正文

请求正文可以为下列任一内容:

名称 说明
UpdateGitCredentialsToAutomaticRequest

包含将 Git 凭据更新为自动的请求数据。

UpdateGitCredentialsToConfiguredConnectionRequest

包含用于更新 Git 凭据以配置连接的请求数据。

UpdateGitCredentialsToNoneRequest

包含将 Git 凭据更新为无的请求数据。

UpdateGitCredentialsToAutomaticRequest

包含将 Git 凭据更新为自动的请求数据。

名称 必需 类型 说明
source True string:

Automatic

Git 凭据源。

UpdateGitCredentialsToConfiguredConnectionRequest

包含用于更新 Git 凭据以配置连接的请求数据。

名称 必需 类型 说明
connectionId True

string (uuid)

连接的对象 ID。

source True string:

ConfiguredConnection

Git 凭据源。

UpdateGitCredentialsToNoneRequest

包含将 Git 凭据更新为无的请求数据。

名称 必需 类型 说明
source True string:

None

Git 凭据源。

响应

名称 类型 说明
200 OK GitCredentialsConfigurationResponse:

请求成功完成。

Other Status Codes

ErrorResponse

常见错误代码:

  • UnknownError - 发生错误。

  • InsufficientPrivileges - 调用方没有足够的工作区权限。

  • WorkspaceNotConnectedToGit - 工作区未连接到 git。

  • ConnectionNotFound - 找不到指定的连接。

  • ConnectionMismatch - 连接与 Git 提供程序详细信息不匹配。

  • PrincipalTypeNotSupported - 不支持调用方标识类型。

示例

Update user's Git credentials to ConfiguredConnection example
Update user's Git credentials to None example

Update user's Git credentials to ConfiguredConnection example

示例请求

PATCH https://api.fabric.microsoft.com/v1/workspaces/1565e6a3-c020-4c0c-dda7-92bafe99eec5/git/myGitCredentials

{
  "source": "ConfiguredConnection",
  "connectionId": "3f2504e0-4f89-11d3-9a0c-0305e82c3301"
}

示例响应

{
  "source": "ConfiguredConnection",
  "connectionId": "3f2504e0-4f89-11d3-9a0c-0305e82c3301"
}

Update user's Git credentials to None example

示例请求

PATCH https://api.fabric.microsoft.com/v1/workspaces/1565e6a3-c020-4c0c-dda7-92bafe99eec5/git/myGitCredentials

{
  "source": "None"
}

示例响应

{
  "source": "None"
}

定义

名称 说明
AutomaticGitCredentialsResponse

自动 Git 凭据。

ConfiguredConnectionGitCredentialsResponse

配置的连接 Git 凭据。

ErrorRelatedResource

与错误相关的资源详细信息对象。

ErrorResponse

错误响应。

ErrorResponseDetails

错误响应详细信息。

GitCredentialsSource

Git 凭据源。 可能会随着时间的推移添加其他 Git 凭据源。

NoneGitCredentialsResponse

未配置 Git 凭据。

UpdateGitCredentialsToAutomaticRequest

包含将 Git 凭据更新为自动的请求数据。

UpdateGitCredentialsToConfiguredConnectionRequest

包含用于更新 Git 凭据以配置连接的请求数据。

UpdateGitCredentialsToNoneRequest

包含将 Git 凭据更新为无的请求数据。

AutomaticGitCredentialsResponse

自动 Git 凭据。

名称 类型 说明
source string:

Automatic

Git 凭据源。

ConfiguredConnectionGitCredentialsResponse

配置的连接 Git 凭据。

名称 类型 说明
connectionId

string (uuid)

连接的对象 ID。

source string:

ConfiguredConnection

Git 凭据源。

ErrorRelatedResource

与错误相关的资源详细信息对象。

名称 类型 说明
resourceId

string

错误中涉及的资源 ID。

resourceType

string

错误中涉及的资源的类型。

ErrorResponse

错误响应。

名称 类型 说明
errorCode

string

提供有关错误条件的信息的特定标识符,允许服务与其用户之间的标准化通信。

message

string

错误的人工可读表示形式。

moreDetails

ErrorResponseDetails[]

其他错误详细信息的列表。

relatedResource

ErrorRelatedResource

与错误相关的资源详细信息。

requestId

string

与错误关联的请求的 ID。

ErrorResponseDetails

错误响应详细信息。

名称 类型 说明
errorCode

string

提供有关错误条件的信息的特定标识符,允许服务与其用户之间的标准化通信。

message

string

错误的人工可读表示形式。

relatedResource

ErrorRelatedResource

与错误相关的资源详细信息。

GitCredentialsSource

Git 凭据源。 可能会随着时间的推移添加其他 Git 凭据源。

说明
Automatic

系统会使用默认凭据(如果可用)自动获取 Git 凭据。

ConfiguredConnection

Git 凭据是通过配置的连接获取的。

None

未配置 Git 凭据。

NoneGitCredentialsResponse

未配置 Git 凭据。

名称 类型 说明
source string:

None

Git 凭据源。

UpdateGitCredentialsToAutomaticRequest

包含将 Git 凭据更新为自动的请求数据。

名称 类型 说明
source string:

Automatic

Git 凭据源。

UpdateGitCredentialsToConfiguredConnectionRequest

包含用于更新 Git 凭据以配置连接的请求数据。

名称 类型 说明
connectionId

string (uuid)

连接的对象 ID。

source string:

ConfiguredConnection

Git 凭据源。

UpdateGitCredentialsToNoneRequest

包含将 Git 凭据更新为无的请求数据。

名称 类型 说明
source string:

None

Git 凭据源。