Share via


Forks - Create fork sync request

Request that another repository's refs be fetched into this one. It syncs two existing forks. To create a fork, please see the repositories endpoint

POST https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryNameOrId}/forkSyncRequests?api-version=7.1
POST https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryNameOrId}/forkSyncRequests?includeLinks={includeLinks}&api-version=7.1

URI Parameters

Name In Required Type Description
organization
path True

string

The name of the Azure DevOps organization.

repositoryNameOrId
path True

string

The name or ID of the repository.

project
path

string

Project ID or project name

api-version
query True

string

Version of the API to use. This should be set to '7.1' to use this version of the api.

includeLinks
query

boolean

True to include links

Request Body

Name Type Description
source

GlobalGitRepositoryKey

Fully-qualified identifier for the source repository.

sourceToTargetRefs

SourceToTargetRef[]

If supplied, the set of ref mappings to use when performing a "sync" or create. If missing, all refs will be synchronized.

Responses

Name Type Description
200 OK

GitForkSyncRequest

successful operation

Security

oauth2

Type: oauth2
Flow: accessCode
Authorization URL: https://app.vssps.visualstudio.com/oauth2/authorize&response_type=Assertion
Token URL: https://app.vssps.visualstudio.com/oauth2/token?client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer&grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer

Scopes

Name Description
vso.code_write Grants the ability to read, update, and delete source code, access metadata about commits, changesets, branches, and other version control artifacts. Also grants the ability to create and manage pull requests and code reviews and to receive notifications about version control events via service hooks.

Definitions

Name Description
GitAsyncOperationStatus
GitForkOperationStatusDetail

Status information about a requested fork operation.

GitForkSyncRequest

Request to sync data between two forks.

GitForkSyncRequestParameters

Parameters for creating a fork request

GlobalGitRepositoryKey

Globally unique key for a repository.

ReferenceLinks

The class to represent a collection of REST reference links.

SourceToTargetRef

GitAsyncOperationStatus

Value Description
abandoned

The operation has been abandoned.

completed

The operation has completed.

failed

The operation has failed. Check for an error message.

inProgress

The operation is currently in progress.

queued

The operation is waiting in a queue and has not yet started.

GitForkOperationStatusDetail

Status information about a requested fork operation.

Name Type Description
allSteps

string[]

All valid steps for the forking process

currentStep

integer (int32)

Index into AllSteps for the current step

errorMessage

string

Error message if the operation failed.

GitForkSyncRequest

Request to sync data between two forks.

Name Type Description
_links

ReferenceLinks

Collection of related links

detailedStatus

GitForkOperationStatusDetail

Status information about a requested fork operation.

operationId

integer (int32)

Unique identifier for the operation.

source

GlobalGitRepositoryKey

Fully-qualified identifier for the source repository.

sourceToTargetRefs

SourceToTargetRef[]

If supplied, the set of ref mappings to use when performing a "sync" or create. If missing, all refs will be synchronized.

status

GitAsyncOperationStatus

GitForkSyncRequestParameters

Parameters for creating a fork request

Name Type Description
source

GlobalGitRepositoryKey

Fully-qualified identifier for the source repository.

sourceToTargetRefs

SourceToTargetRef[]

If supplied, the set of ref mappings to use when performing a "sync" or create. If missing, all refs will be synchronized.

GlobalGitRepositoryKey

Globally unique key for a repository.

Name Type Description
collectionId

string (uuid)

Team Project Collection ID of the collection for the repository.

projectId

string (uuid)

Team Project ID of the project for the repository.

repositoryId

string (uuid)

ID of the repository.

The class to represent a collection of REST reference links.

Name Type Description
links

object

The readonly view of the links. Because Reference links are readonly, we only want to expose them as read only.

SourceToTargetRef

Name Type Description
sourceRef

string

The source ref to copy. For example, refs/heads/master.

targetRef

string

The target ref to update. For example, refs/heads/master.