Azure DevOps v3.8.0 published on Monday, Mar 17, 2025 by Pulumi
azuredevops.getGitRepository
Explore with Pulumi AI
Use this data source to access information about a single (existing) Git Repository within Azure DevOps.
To read information about multiple Git Repositories use the data source azuredevops.getRepositories
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as azuredevops from "@pulumi/azuredevops";
const example = azuredevops.getProject({
    name: "Example Project",
});
// Load a specific Git repository by name
const example_single_repo = example.then(example => azuredevops.getGitRepository({
    projectId: example.id,
    name: "Example Repository",
}));
import pulumi
import pulumi_azuredevops as azuredevops
example = azuredevops.get_project(name="Example Project")
# Load a specific Git repository by name
example_single_repo = azuredevops.get_git_repository(project_id=example.id,
    name="Example Repository")
package main
import (
	"github.com/pulumi/pulumi-azuredevops/sdk/v3/go/azuredevops"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := azuredevops.LookupProject(ctx, &azuredevops.LookupProjectArgs{
			Name: pulumi.StringRef("Example Project"),
		}, nil)
		if err != nil {
			return err
		}
		// Load a specific Git repository by name
		_, err = azuredevops.GetGitRepository(ctx, &azuredevops.GetGitRepositoryArgs{
			ProjectId: example.Id,
			Name:      "Example Repository",
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureDevOps = Pulumi.AzureDevOps;
return await Deployment.RunAsync(() => 
{
    var example = AzureDevOps.GetProject.Invoke(new()
    {
        Name = "Example Project",
    });
    // Load a specific Git repository by name
    var example_single_repo = AzureDevOps.GetGitRepository.Invoke(new()
    {
        ProjectId = example.Apply(getProjectResult => getProjectResult.Id),
        Name = "Example Repository",
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azuredevops.AzuredevopsFunctions;
import com.pulumi.azuredevops.inputs.GetProjectArgs;
import com.pulumi.azuredevops.inputs.GetGitRepositoryArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }
    public static void stack(Context ctx) {
        final var example = AzuredevopsFunctions.getProject(GetProjectArgs.builder()
            .name("Example Project")
            .build());
        // Load a specific Git repository by name
        final var example-single-repo = AzuredevopsFunctions.getGitRepository(GetGitRepositoryArgs.builder()
            .projectId(example.applyValue(getProjectResult -> getProjectResult.id()))
            .name("Example Repository")
            .build());
    }
}
variables:
  example:
    fn::invoke:
      function: azuredevops:getProject
      arguments:
        name: Example Project
  # Load a specific Git repository by name
  example-single-repo:
    fn::invoke:
      function: azuredevops:getGitRepository
      arguments:
        projectId: ${example.id}
        name: Example Repository
Relevant Links
Using getGitRepository
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getGitRepository(args: GetGitRepositoryArgs, opts?: InvokeOptions): Promise<GetGitRepositoryResult>
function getGitRepositoryOutput(args: GetGitRepositoryOutputArgs, opts?: InvokeOptions): Output<GetGitRepositoryResult>def get_git_repository(name: Optional[str] = None,
                       project_id: Optional[str] = None,
                       opts: Optional[InvokeOptions] = None) -> GetGitRepositoryResult
def get_git_repository_output(name: Optional[pulumi.Input[str]] = None,
                       project_id: Optional[pulumi.Input[str]] = None,
                       opts: Optional[InvokeOptions] = None) -> Output[GetGitRepositoryResult]func GetGitRepository(ctx *Context, args *GetGitRepositoryArgs, opts ...InvokeOption) (*GetGitRepositoryResult, error)
func GetGitRepositoryOutput(ctx *Context, args *GetGitRepositoryOutputArgs, opts ...InvokeOption) GetGitRepositoryResultOutput> Note: This function is named GetGitRepository in the Go SDK.
public static class GetGitRepository 
{
    public static Task<GetGitRepositoryResult> InvokeAsync(GetGitRepositoryArgs args, InvokeOptions? opts = null)
    public static Output<GetGitRepositoryResult> Invoke(GetGitRepositoryInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetGitRepositoryResult> getGitRepository(GetGitRepositoryArgs args, InvokeOptions options)
public static Output<GetGitRepositoryResult> getGitRepository(GetGitRepositoryArgs args, InvokeOptions options)
fn::invoke:
  function: azuredevops:index/getGitRepository:getGitRepository
  arguments:
    # arguments dictionaryThe following arguments are supported:
- name str
- The Name of the Git repository to retrieve
- project_id str
- The ID of project to list Git repositories
getGitRepository Result
The following output properties are available:
- DefaultBranch string
- The ref of the default branch.
- Disabled bool
- Indicates whether the repository is disabled.
- Id string
- The provider-assigned unique ID for this managed resource.
- IsFork bool
- Name string
- The name of the Git repository.
- ProjectId string
- Project identifier to which the Git repository belongs.
- RemoteUrl string
- HTTPS Url to clone the Git repository
- Size int
- Compressed size (bytes) of the repository.
- SshUrl string
- SSH Url to clone the Git repository
- Url string
- The details REST API endpoint for the Git Repository.
- WebUrl string
- The Url of the Git repository web view
- DefaultBranch string
- The ref of the default branch.
- Disabled bool
- Indicates whether the repository is disabled.
- Id string
- The provider-assigned unique ID for this managed resource.
- IsFork bool
- Name string
- The name of the Git repository.
- ProjectId string
- Project identifier to which the Git repository belongs.
- RemoteUrl string
- HTTPS Url to clone the Git repository
- Size int
- Compressed size (bytes) of the repository.
- SshUrl string
- SSH Url to clone the Git repository
- Url string
- The details REST API endpoint for the Git Repository.
- WebUrl string
- The Url of the Git repository web view
- defaultBranch String
- The ref of the default branch.
- disabled Boolean
- Indicates whether the repository is disabled.
- id String
- The provider-assigned unique ID for this managed resource.
- isFork Boolean
- name String
- The name of the Git repository.
- projectId String
- Project identifier to which the Git repository belongs.
- remoteUrl String
- HTTPS Url to clone the Git repository
- size Integer
- Compressed size (bytes) of the repository.
- sshUrl String
- SSH Url to clone the Git repository
- url String
- The details REST API endpoint for the Git Repository.
- webUrl String
- The Url of the Git repository web view
- defaultBranch string
- The ref of the default branch.
- disabled boolean
- Indicates whether the repository is disabled.
- id string
- The provider-assigned unique ID for this managed resource.
- isFork boolean
- name string
- The name of the Git repository.
- projectId string
- Project identifier to which the Git repository belongs.
- remoteUrl string
- HTTPS Url to clone the Git repository
- size number
- Compressed size (bytes) of the repository.
- sshUrl string
- SSH Url to clone the Git repository
- url string
- The details REST API endpoint for the Git Repository.
- webUrl string
- The Url of the Git repository web view
- default_branch str
- The ref of the default branch.
- disabled bool
- Indicates whether the repository is disabled.
- id str
- The provider-assigned unique ID for this managed resource.
- is_fork bool
- name str
- The name of the Git repository.
- project_id str
- Project identifier to which the Git repository belongs.
- remote_url str
- HTTPS Url to clone the Git repository
- size int
- Compressed size (bytes) of the repository.
- ssh_url str
- SSH Url to clone the Git repository
- url str
- The details REST API endpoint for the Git Repository.
- web_url str
- The Url of the Git repository web view
- defaultBranch String
- The ref of the default branch.
- disabled Boolean
- Indicates whether the repository is disabled.
- id String
- The provider-assigned unique ID for this managed resource.
- isFork Boolean
- name String
- The name of the Git repository.
- projectId String
- Project identifier to which the Git repository belongs.
- remoteUrl String
- HTTPS Url to clone the Git repository
- size Number
- Compressed size (bytes) of the repository.
- sshUrl String
- SSH Url to clone the Git repository
- url String
- The details REST API endpoint for the Git Repository.
- webUrl String
- The Url of the Git repository web view
Package Details
- Repository
- Azure DevOps pulumi/pulumi-azuredevops
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the azuredevopsTerraform Provider.