Git - Get My Git Credentials
返回用户的 Git 凭据配置详细信息。
指示如何获取用户的凭据以自动或通过配置的连接访问相关 Git 提供程序。 如果未配置用户的凭据,请转到 “更新我的 Git 凭据 API”。
权限
调用方必须具有 参与者 或更高版本的工作区角色。
所需的委派范围
Workspace.Read.All 或 Workspace.ReadWrite.All
Microsoft Entra 支持的标识
此 API 支持本节中列出的Microsoft 标识。
身份 | 支持 |
---|---|
用户 | 是的 |
服务主体 和 托管标识 | 是的 |
接口
GET https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/git/myGitCredentials
URI 参数
名称 | 在 | 必需 | 类型 | 说明 |
---|---|---|---|---|
workspace
|
path | True |
string (uuid) |
工作区 ID。 |
响应
名称 | 类型 | 说明 |
---|---|---|
200 OK | GitCredentialsConfigurationResponse: |
请求成功完成。 |
Other Status Codes |
常见错误代码:
|
示例
Get the user's Git credentials configuration for Azure DevOps when it is automatic example
示例请求
GET https://api.fabric.microsoft.com/v1/workspaces/1565e6a3-c020-4c0c-dda7-92bafe99eec5/git/myGitCredentials
示例响应
{
"source": "Automatic"
}
Get the user's Git credentials configuration when it is configured by connection example
示例请求
GET https://api.fabric.microsoft.com/v1/workspaces/1565e6a3-c020-4c0c-dda7-92bafe99eec5/git/myGitCredentials
示例响应
{
"source": "ConfiguredConnection",
"connectionId": "3f2504e0-4f89-11d3-9a0c-0305e82c3301"
}
Get the user's Git credentials configuration when it is not configured example
示例请求
GET https://api.fabric.microsoft.com/v1/workspaces/1565e6a3-c020-4c0c-dda7-92bafe99eec5/git/myGitCredentials
示例响应
{
"source": "None"
}
定义
名称 | 说明 |
---|---|
Automatic |
自动 Git 凭据。 |
Configured |
配置的连接 Git 凭据。 |
Error |
与错误相关的资源详细信息对象。 |
Error |
错误响应。 |
Error |
错误响应详细信息。 |
Git |
Git 凭据源。 可能会随着时间的推移添加其他 Git 凭据源。 |
None |
未配置 Git 凭据。 |
AutomaticGitCredentialsResponse
自动 Git 凭据。
名称 | 类型 | 说明 |
---|---|---|
source |
string:
Automatic |
Git 凭据源。 |
ConfiguredConnectionGitCredentialsResponse
配置的连接 Git 凭据。
名称 | 类型 | 说明 |
---|---|---|
connectionId |
string (uuid) |
连接的对象 ID。 |
source |
string:
Configured |
Git 凭据源。 |
ErrorRelatedResource
与错误相关的资源详细信息对象。
名称 | 类型 | 说明 |
---|---|---|
resourceId |
string |
错误中涉及的资源 ID。 |
resourceType |
string |
错误中涉及的资源的类型。 |
ErrorResponse
错误响应。
名称 | 类型 | 说明 |
---|---|---|
errorCode |
string |
提供有关错误条件的信息的特定标识符,允许服务与其用户之间的标准化通信。 |
message |
string |
错误的人工可读表示形式。 |
moreDetails |
其他错误详细信息的列表。 |
|
relatedResource |
与错误相关的资源详细信息。 |
|
requestId |
string |
与错误关联的请求的 ID。 |
ErrorResponseDetails
错误响应详细信息。
名称 | 类型 | 说明 |
---|---|---|
errorCode |
string |
提供有关错误条件的信息的特定标识符,允许服务与其用户之间的标准化通信。 |
message |
string |
错误的人工可读表示形式。 |
relatedResource |
与错误相关的资源详细信息。 |
GitCredentialsSource
Git 凭据源。 可能会随着时间的推移添加其他 Git 凭据源。
值 | 说明 |
---|---|
Automatic |
系统会使用默认凭据(如果可用)自动获取 Git 凭据。 |
ConfiguredConnection |
Git 凭据是通过配置的连接获取的。 |
None |
未配置 Git 凭据。 |
NoneGitCredentialsResponse
未配置 Git 凭据。
名称 | 类型 | 说明 |
---|---|---|
source |
string:
None |
Git 凭据源。 |