Repositories - List

Retrieve git repositories.

GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories?api-version=6.0
GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories?includeLinks={includeLinks}&includeAllUrls={includeAllUrls}&includeHidden={includeHidden}&api-version=6.0

URI Parameters

Name In Required Type Description
organization
path True

string

The name of the Azure DevOps organization.

project
path

string

Project ID or project name

api-version
query True

string

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

includeAllUrls
query

boolean

[optional] True to include all remote URLs. The default value is false.

includeHidden
query

boolean

[optional] True to include hidden repositories. The default value is false.

includeLinks
query

boolean

[optional] True to include reference links. The default value is false.

Responses

Name Type Description
200 OK

GitRepository[]

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 Grants the ability to read source code and metadata about commits, changesets, branches, and other version control artifacts. Also grants the ability to search code and get notified about version control events via service hooks.

Examples

Sample Request

GET https://dev.azure.com/fabrikam/_apis/git/repositories?api-version=6.0

Sample Response

{
  "count": 3,
  "value": [
    {
      "id": "5febef5a-833d-4e14-b9c0-14cb638f91e6",
      "name": "AnotherRepository",
      "url": "https://dev.azure.com/fabrikam/_apis/git/repositories/5febef5a-833d-4e14-b9c0-14cb638f91e6",
      "project": {
        "id": "6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c",
        "name": "Fabrikam-Fiber-Git",
        "url": "https://dev.azure.com/fabrikam/_apis/projects/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c",
        "state": "wellFormed"
      },
      "remoteUrl": "https://dev.azure.com/fabrikam/Fabrikam-Fiber-Git/_git/AnotherRepository"
    },
    {
      "id": "278d5cd2-584d-4b63-824a-2ba458937249",
      "name": "Fabrikam-Fiber-Git",
      "url": "https://dev.azure.com/fabrikam/_apis/git/repositories/278d5cd2-584d-4b63-824a-2ba458937249",
      "project": {
        "id": "6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c",
        "name": "Fabrikam-Fiber-Git",
        "url": "https://dev.azure.com/fabrikam/_apis/projects/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c",
        "state": "wellFormed"
      },
      "defaultBranch": "refs/heads/master",
      "remoteUrl": "https://dev.azure.com/fabrikam/_git/Fabrikam-Fiber-Git"
    },
    {
      "id": "66efb083-777a-4cac-a350-a24b046be6be",
      "name": "TestGit",
      "url": "https://dev.azure.com/fabrikam/_apis/git/repositories/66efb083-777a-4cac-a350-a24b046be6be",
      "project": {
        "id": "281f9a5b-af0d-49b4-a1df-fe6f5e5f84d0",
        "name": "TestGit",
        "url": "https://dev.azure.com/fabrikam/_apis/projects/281f9a5b-af0d-49b4-a1df-fe6f5e5f84d0",
        "state": "wellFormed"
      },
      "defaultBranch": "refs/heads/master",
      "remoteUrl": "https://dev.azure.com/fabrikam/_git/TestGit"
    }
  ]
}

Definitions

Name Description
GitRepository
GitRepositoryRef
ProjectState

Project state.

ProjectVisibility

Project visibility.

ReferenceLinks

The class to represent a collection of REST reference links.

TeamProjectCollectionReference

Reference object for a TeamProjectCollection.

TeamProjectReference

Represents a shallow reference to a TeamProject.

GitRepository

Name Type Description
_links

ReferenceLinks

The class to represent a collection of REST reference links.

defaultBranch

string

id

string

isFork

boolean

True if the repository was created as a fork

name

string

parentRepository

GitRepositoryRef

project

TeamProjectReference

Represents a shallow reference to a TeamProject.

remoteUrl

string

size

integer

Compressed size (bytes) of the repository.

sshUrl

string

url

string

validRemoteUrls

string[]

webUrl

string

GitRepositoryRef

Name Type Description
collection

TeamProjectCollectionReference

Team Project Collection where this Fork resides

id

string

isFork

boolean

True if the repository was created as a fork

name

string

project

TeamProjectReference

Represents a shallow reference to a TeamProject.

remoteUrl

string

sshUrl

string

url

string

ProjectState

Project state.

Name Type Description
all

string

All projects regardless of state.

createPending

string

Project has been queued for creation, but the process has not yet started.

deleted

string

Project has been deleted.

deleting

string

Project is in the process of being deleted.

new

string

Project is in the process of being created.

unchanged

string

Project has not been changed.

wellFormed

string

Project is completely created and ready to use.

ProjectVisibility

Project visibility.

Name Type Description
private

string

The project is only visible to users with explicit access.

public

string

The project is visible to all.

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.

TeamProjectCollectionReference

Reference object for a TeamProjectCollection.

Name Type Description
id

string

Collection Id.

name

string

Collection Name.

url

string

Collection REST Url.

TeamProjectReference

Represents a shallow reference to a TeamProject.

Name Type Description
abbreviation

string

Project abbreviation.

defaultTeamImageUrl

string

Url to default team identity image.

description

string

The project's description (if any).

id

string

Project identifier.

lastUpdateTime

string

Project last update time.

name

string

Project name.

revision

integer

Project revision.

state

ProjectState

Project state.

url

string

Url to the full version of the object.

visibility

ProjectVisibility

Project visibility.