- HTTP request
- Path parameters
- Query parameters
- Request body
- Response body
- Authorization scopes
- IAM Permissions
- RefType
- Try it!
Fetch the list of branches or tags for a given repository.
HTTP request
GET https://cloudbuild.googleapis.com/v2/{repository=projects/*/locations/*/connections/*/repositories/*}:fetchGitRefs
The URL uses gRPC Transcoding syntax.
Path parameters
| Parameters | |
|---|---|
| repository | 
 Required. The resource name of the repository in the format  | 
Query parameters
| Parameters | |
|---|---|
| refType | 
 Type of refs to fetch | 
| pageSize | 
 Optional. Number of results to return in the list. Default to 20. | 
| pageToken | 
 Optional. Page start. | 
Request body
The request body must be empty.
Response body
Response for fetching git refs
If successful, the response body contains data with the following structure:
| JSON representation | 
|---|
| { "refNames": [ string ], "nextPageToken": string } | 
| Fields | |
|---|---|
| refNames[] | 
 Name of the refs fetched. | 
| nextPageToken | 
 A token identifying a page of results the server should return. | 
Authorization scopes
Requires the following OAuth scope:
- https://www.googleapis.com/auth/cloud-platform
For more information, see the Authentication Overview.
IAM Permissions
Requires the following IAM permission on the repository resource:
- cloudbuild.repositories.fetchGitRefs
For more information, see the IAM documentation.
RefType
Type of refs
| Enums | |
|---|---|
| REF_TYPE_UNSPECIFIED | No type specified. | 
| TAG | To fetch tags. | 
| BRANCH | To fetch branches. |