1. Packages
  2. Azure DevOps Provider
  3. API Docs
  4. Git
Azure DevOps v3.8.0 published on Monday, Mar 17, 2025 by Pulumi

azuredevops.Git

Explore with Pulumi AI

Import

Azure DevOps Repositories can be imported using the repo name or by the repo Guid e.g.

$ pulumi import azuredevops:index/git:Git example projectName/repoName
Copy

or

$ pulumi import azuredevops:index/git:Git example projectName/00000000-0000-0000-0000-000000000000
Copy

Create Git Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new Git(name: string, args: GitArgs, opts?: CustomResourceOptions);
@overload
def Git(resource_name: str,
        args: GitArgs,
        opts: Optional[ResourceOptions] = None)

@overload
def Git(resource_name: str,
        opts: Optional[ResourceOptions] = None,
        initialization: Optional[GitInitializationArgs] = None,
        project_id: Optional[str] = None,
        default_branch: Optional[str] = None,
        disabled: Optional[bool] = None,
        name: Optional[str] = None,
        parent_repository_id: Optional[str] = None)
func NewGit(ctx *Context, name string, args GitArgs, opts ...ResourceOption) (*Git, error)
public Git(string name, GitArgs args, CustomResourceOptions? opts = null)
public Git(String name, GitArgs args)
public Git(String name, GitArgs args, CustomResourceOptions options)
type: azuredevops:Git
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. GitArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. GitArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. GitArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. GitArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. GitArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var gitResource = new AzureDevOps.Git("gitResource", new()
{
    Initialization = new AzureDevOps.Inputs.GitInitializationArgs
    {
        InitType = "string",
        Password = "string",
        ServiceConnectionId = "string",
        SourceType = "string",
        SourceUrl = "string",
        Username = "string",
    },
    ProjectId = "string",
    DefaultBranch = "string",
    Disabled = false,
    Name = "string",
    ParentRepositoryId = "string",
});
Copy
example, err := azuredevops.NewGit(ctx, "gitResource", &azuredevops.GitArgs{
	Initialization: &azuredevops.GitInitializationArgs{
		InitType:            pulumi.String("string"),
		Password:            pulumi.String("string"),
		ServiceConnectionId: pulumi.String("string"),
		SourceType:          pulumi.String("string"),
		SourceUrl:           pulumi.String("string"),
		Username:            pulumi.String("string"),
	},
	ProjectId:          pulumi.String("string"),
	DefaultBranch:      pulumi.String("string"),
	Disabled:           pulumi.Bool(false),
	Name:               pulumi.String("string"),
	ParentRepositoryId: pulumi.String("string"),
})
Copy
var gitResource = new Git("gitResource", GitArgs.builder()
    .initialization(GitInitializationArgs.builder()
        .initType("string")
        .password("string")
        .serviceConnectionId("string")
        .sourceType("string")
        .sourceUrl("string")
        .username("string")
        .build())
    .projectId("string")
    .defaultBranch("string")
    .disabled(false)
    .name("string")
    .parentRepositoryId("string")
    .build());
Copy
git_resource = azuredevops.Git("gitResource",
    initialization={
        "init_type": "string",
        "password": "string",
        "service_connection_id": "string",
        "source_type": "string",
        "source_url": "string",
        "username": "string",
    },
    project_id="string",
    default_branch="string",
    disabled=False,
    name="string",
    parent_repository_id="string")
Copy
const gitResource = new azuredevops.Git("gitResource", {
    initialization: {
        initType: "string",
        password: "string",
        serviceConnectionId: "string",
        sourceType: "string",
        sourceUrl: "string",
        username: "string",
    },
    projectId: "string",
    defaultBranch: "string",
    disabled: false,
    name: "string",
    parentRepositoryId: "string",
});
Copy
type: azuredevops:Git
properties:
    defaultBranch: string
    disabled: false
    initialization:
        initType: string
        password: string
        serviceConnectionId: string
        sourceType: string
        sourceUrl: string
        username: string
    name: string
    parentRepositoryId: string
    projectId: string
Copy

Git Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The Git resource accepts the following input properties:

Initialization This property is required. Pulumi.AzureDevOps.Inputs.GitInitialization
A initialization block as documented below.
ProjectId
This property is required.
Changes to this property will trigger replacement.
string
The project ID or project name.
DefaultBranch string
The ref of the default branch. Will be used as the branch name for initialized repositories.
Disabled bool
The ability to disable or enable the repository. Defaults to false.
Name string
The name of the git repository.
ParentRepositoryId string
The ID of a Git project from which a fork is to be created.
Initialization This property is required. GitInitializationArgs
A initialization block as documented below.
ProjectId
This property is required.
Changes to this property will trigger replacement.
string
The project ID or project name.
DefaultBranch string
The ref of the default branch. Will be used as the branch name for initialized repositories.
Disabled bool
The ability to disable or enable the repository. Defaults to false.
Name string
The name of the git repository.
ParentRepositoryId string
The ID of a Git project from which a fork is to be created.
initialization This property is required. GitInitialization
A initialization block as documented below.
projectId
This property is required.
Changes to this property will trigger replacement.
String
The project ID or project name.
defaultBranch String
The ref of the default branch. Will be used as the branch name for initialized repositories.
disabled Boolean
The ability to disable or enable the repository. Defaults to false.
name String
The name of the git repository.
parentRepositoryId String
The ID of a Git project from which a fork is to be created.
initialization This property is required. GitInitialization
A initialization block as documented below.
projectId
This property is required.
Changes to this property will trigger replacement.
string
The project ID or project name.
defaultBranch string
The ref of the default branch. Will be used as the branch name for initialized repositories.
disabled boolean
The ability to disable or enable the repository. Defaults to false.
name string
The name of the git repository.
parentRepositoryId string
The ID of a Git project from which a fork is to be created.
initialization This property is required. GitInitializationArgs
A initialization block as documented below.
project_id
This property is required.
Changes to this property will trigger replacement.
str
The project ID or project name.
default_branch str
The ref of the default branch. Will be used as the branch name for initialized repositories.
disabled bool
The ability to disable or enable the repository. Defaults to false.
name str
The name of the git repository.
parent_repository_id str
The ID of a Git project from which a fork is to be created.
initialization This property is required. Property Map
A initialization block as documented below.
projectId
This property is required.
Changes to this property will trigger replacement.
String
The project ID or project name.
defaultBranch String
The ref of the default branch. Will be used as the branch name for initialized repositories.
disabled Boolean
The ability to disable or enable the repository. Defaults to false.
name String
The name of the git repository.
parentRepositoryId String
The ID of a Git project from which a fork is to be created.

Outputs

All input properties are implicitly available as output properties. Additionally, the Git resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
IsFork bool
True if the repository was created as a fork.
RemoteUrl string
Git HTTPS URL of the repository
Size int
Size in bytes.
SshUrl string
Git SSH URL of the repository.
Url string
REST API URL of the repository.
WebUrl string
Web link to the repository.
Id string
The provider-assigned unique ID for this managed resource.
IsFork bool
True if the repository was created as a fork.
RemoteUrl string
Git HTTPS URL of the repository
Size int
Size in bytes.
SshUrl string
Git SSH URL of the repository.
Url string
REST API URL of the repository.
WebUrl string
Web link to the repository.
id String
The provider-assigned unique ID for this managed resource.
isFork Boolean
True if the repository was created as a fork.
remoteUrl String
Git HTTPS URL of the repository
size Integer
Size in bytes.
sshUrl String
Git SSH URL of the repository.
url String
REST API URL of the repository.
webUrl String
Web link to the repository.
id string
The provider-assigned unique ID for this managed resource.
isFork boolean
True if the repository was created as a fork.
remoteUrl string
Git HTTPS URL of the repository
size number
Size in bytes.
sshUrl string
Git SSH URL of the repository.
url string
REST API URL of the repository.
webUrl string
Web link to the repository.
id str
The provider-assigned unique ID for this managed resource.
is_fork bool
True if the repository was created as a fork.
remote_url str
Git HTTPS URL of the repository
size int
Size in bytes.
ssh_url str
Git SSH URL of the repository.
url str
REST API URL of the repository.
web_url str
Web link to the repository.
id String
The provider-assigned unique ID for this managed resource.
isFork Boolean
True if the repository was created as a fork.
remoteUrl String
Git HTTPS URL of the repository
size Number
Size in bytes.
sshUrl String
Git SSH URL of the repository.
url String
REST API URL of the repository.
webUrl String
Web link to the repository.

Look up Existing Git Resource

Get an existing Git resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: GitState, opts?: CustomResourceOptions): Git
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        default_branch: Optional[str] = None,
        disabled: Optional[bool] = None,
        initialization: Optional[GitInitializationArgs] = None,
        is_fork: Optional[bool] = None,
        name: Optional[str] = None,
        parent_repository_id: Optional[str] = None,
        project_id: Optional[str] = None,
        remote_url: Optional[str] = None,
        size: Optional[int] = None,
        ssh_url: Optional[str] = None,
        url: Optional[str] = None,
        web_url: Optional[str] = None) -> Git
func GetGit(ctx *Context, name string, id IDInput, state *GitState, opts ...ResourceOption) (*Git, error)
public static Git Get(string name, Input<string> id, GitState? state, CustomResourceOptions? opts = null)
public static Git get(String name, Output<String> id, GitState state, CustomResourceOptions options)
resources:  _:    type: azuredevops:Git    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
DefaultBranch string
The ref of the default branch. Will be used as the branch name for initialized repositories.
Disabled bool
The ability to disable or enable the repository. Defaults to false.
Initialization Pulumi.AzureDevOps.Inputs.GitInitialization
A initialization block as documented below.
IsFork bool
True if the repository was created as a fork.
Name string
The name of the git repository.
ParentRepositoryId string
The ID of a Git project from which a fork is to be created.
ProjectId Changes to this property will trigger replacement. string
The project ID or project name.
RemoteUrl string
Git HTTPS URL of the repository
Size int
Size in bytes.
SshUrl string
Git SSH URL of the repository.
Url string
REST API URL of the repository.
WebUrl string
Web link to the repository.
DefaultBranch string
The ref of the default branch. Will be used as the branch name for initialized repositories.
Disabled bool
The ability to disable or enable the repository. Defaults to false.
Initialization GitInitializationArgs
A initialization block as documented below.
IsFork bool
True if the repository was created as a fork.
Name string
The name of the git repository.
ParentRepositoryId string
The ID of a Git project from which a fork is to be created.
ProjectId Changes to this property will trigger replacement. string
The project ID or project name.
RemoteUrl string
Git HTTPS URL of the repository
Size int
Size in bytes.
SshUrl string
Git SSH URL of the repository.
Url string
REST API URL of the repository.
WebUrl string
Web link to the repository.
defaultBranch String
The ref of the default branch. Will be used as the branch name for initialized repositories.
disabled Boolean
The ability to disable or enable the repository. Defaults to false.
initialization GitInitialization
A initialization block as documented below.
isFork Boolean
True if the repository was created as a fork.
name String
The name of the git repository.
parentRepositoryId String
The ID of a Git project from which a fork is to be created.
projectId Changes to this property will trigger replacement. String
The project ID or project name.
remoteUrl String
Git HTTPS URL of the repository
size Integer
Size in bytes.
sshUrl String
Git SSH URL of the repository.
url String
REST API URL of the repository.
webUrl String
Web link to the repository.
defaultBranch string
The ref of the default branch. Will be used as the branch name for initialized repositories.
disabled boolean
The ability to disable or enable the repository. Defaults to false.
initialization GitInitialization
A initialization block as documented below.
isFork boolean
True if the repository was created as a fork.
name string
The name of the git repository.
parentRepositoryId string
The ID of a Git project from which a fork is to be created.
projectId Changes to this property will trigger replacement. string
The project ID or project name.
remoteUrl string
Git HTTPS URL of the repository
size number
Size in bytes.
sshUrl string
Git SSH URL of the repository.
url string
REST API URL of the repository.
webUrl string
Web link to the repository.
default_branch str
The ref of the default branch. Will be used as the branch name for initialized repositories.
disabled bool
The ability to disable or enable the repository. Defaults to false.
initialization GitInitializationArgs
A initialization block as documented below.
is_fork bool
True if the repository was created as a fork.
name str
The name of the git repository.
parent_repository_id str
The ID of a Git project from which a fork is to be created.
project_id Changes to this property will trigger replacement. str
The project ID or project name.
remote_url str
Git HTTPS URL of the repository
size int
Size in bytes.
ssh_url str
Git SSH URL of the repository.
url str
REST API URL of the repository.
web_url str
Web link to the repository.
defaultBranch String
The ref of the default branch. Will be used as the branch name for initialized repositories.
disabled Boolean
The ability to disable or enable the repository. Defaults to false.
initialization Property Map
A initialization block as documented below.
isFork Boolean
True if the repository was created as a fork.
name String
The name of the git repository.
parentRepositoryId String
The ID of a Git project from which a fork is to be created.
projectId Changes to this property will trigger replacement. String
The project ID or project name.
remoteUrl String
Git HTTPS URL of the repository
size Number
Size in bytes.
sshUrl String
Git SSH URL of the repository.
url String
REST API URL of the repository.
webUrl String
Web link to the repository.

Supporting Types

GitInitialization
, GitInitializationArgs

InitType This property is required. string
The type of repository to create. Valid values: Uninitialized, Clean or Import.
Password string

The password used to authenticate to a private repository for import initialization. Conflicts with service_connection_id.

~>Note At least service_connection_id or username/password needs to be set to import private repository.

ServiceConnectionId string
The ID of service connection used to authenticate to a private repository for import initialization. Conflicts with username and password.
SourceType string
Type of the source repository. Used if the init_type is Import. Valid values: Git.
SourceUrl string
The URL of the source repository. Used if the init_type is Import.
Username string
The username used to authenticate to a private repository for import initialization. Conflicts with service_connection_id.
InitType This property is required. string
The type of repository to create. Valid values: Uninitialized, Clean or Import.
Password string

The password used to authenticate to a private repository for import initialization. Conflicts with service_connection_id.

~>Note At least service_connection_id or username/password needs to be set to import private repository.

ServiceConnectionId string
The ID of service connection used to authenticate to a private repository for import initialization. Conflicts with username and password.
SourceType string
Type of the source repository. Used if the init_type is Import. Valid values: Git.
SourceUrl string
The URL of the source repository. Used if the init_type is Import.
Username string
The username used to authenticate to a private repository for import initialization. Conflicts with service_connection_id.
initType This property is required. String
The type of repository to create. Valid values: Uninitialized, Clean or Import.
password String

The password used to authenticate to a private repository for import initialization. Conflicts with service_connection_id.

~>Note At least service_connection_id or username/password needs to be set to import private repository.

serviceConnectionId String
The ID of service connection used to authenticate to a private repository for import initialization. Conflicts with username and password.
sourceType String
Type of the source repository. Used if the init_type is Import. Valid values: Git.
sourceUrl String
The URL of the source repository. Used if the init_type is Import.
username String
The username used to authenticate to a private repository for import initialization. Conflicts with service_connection_id.
initType This property is required. string
The type of repository to create. Valid values: Uninitialized, Clean or Import.
password string

The password used to authenticate to a private repository for import initialization. Conflicts with service_connection_id.

~>Note At least service_connection_id or username/password needs to be set to import private repository.

serviceConnectionId string
The ID of service connection used to authenticate to a private repository for import initialization. Conflicts with username and password.
sourceType string
Type of the source repository. Used if the init_type is Import. Valid values: Git.
sourceUrl string
The URL of the source repository. Used if the init_type is Import.
username string
The username used to authenticate to a private repository for import initialization. Conflicts with service_connection_id.
init_type This property is required. str
The type of repository to create. Valid values: Uninitialized, Clean or Import.
password str

The password used to authenticate to a private repository for import initialization. Conflicts with service_connection_id.

~>Note At least service_connection_id or username/password needs to be set to import private repository.

service_connection_id str
The ID of service connection used to authenticate to a private repository for import initialization. Conflicts with username and password.
source_type str
Type of the source repository. Used if the init_type is Import. Valid values: Git.
source_url str
The URL of the source repository. Used if the init_type is Import.
username str
The username used to authenticate to a private repository for import initialization. Conflicts with service_connection_id.
initType This property is required. String
The type of repository to create. Valid values: Uninitialized, Clean or Import.
password String

The password used to authenticate to a private repository for import initialization. Conflicts with service_connection_id.

~>Note At least service_connection_id or username/password needs to be set to import private repository.

serviceConnectionId String
The ID of service connection used to authenticate to a private repository for import initialization. Conflicts with username and password.
sourceType String
Type of the source repository. Used if the init_type is Import. Valid values: Git.
sourceUrl String
The URL of the source repository. Used if the init_type is Import.
username String
The username used to authenticate to a private repository for import initialization. Conflicts with service_connection_id.

Package Details

Repository
Azure DevOps pulumi/pulumi-azuredevops
License
Apache-2.0
Notes
This Pulumi package is based on the azuredevops Terraform Provider.