1. Packages
  2. Azure DevOps Provider
  3. API Docs
  4. Git
Viewing docs for Azure DevOps v3.14.0
published on Tuesday, Mar 24, 2026 by Pulumi
azuredevops logo
Viewing docs for Azure DevOps v3.14.0
published on Tuesday, Mar 24, 2026 by Pulumi

    Manages a git repository within Azure DevOps.

    ~>NOTE Importing an existing repository and running pulumi preview will detect a difference on the initialization block. The plan and apply will then attempt to update the repository based on the initialization configurations. It may be necessary to ignore the initialization block from plan and apply to support configuring existing repositories imported into Terraform state.

    ~>NOTE 1. initialization.init_type is Uninitialized: Changing source_type or source_url will not recreate the repository, but initialize the repository.
    2. initialization.init_type is not Uninitialized:
        1) Updating init_type will recreate the repository
        2) Updating source_type or source_url will recreate the repository

    import * as pulumi from "@pulumi/pulumi";
    import * as azuredevops from "@pulumi/azuredevops";
    
    const example = new azuredevops.Project("example", {
        name: "Example Project",
        visibility: "private",
        versionControl: "Git",
        workItemTemplate: "Agile",
    });
    const exampleGit = new azuredevops.Git("example", {
        projectId: example.id,
        name: "Example Git Repository",
        defaultBranch: "refs/heads/main",
        initialization: {
            initType: "Clean",
        },
    });
    
    import pulumi
    import pulumi_azuredevops as azuredevops
    
    example = azuredevops.Project("example",
        name="Example Project",
        visibility="private",
        version_control="Git",
        work_item_template="Agile")
    example_git = azuredevops.Git("example",
        project_id=example.id,
        name="Example Git Repository",
        default_branch="refs/heads/main",
        initialization={
            "init_type": "Clean",
        })
    
    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.NewProject(ctx, "example", &azuredevops.ProjectArgs{
    			Name:             pulumi.String("Example Project"),
    			Visibility:       pulumi.String("private"),
    			VersionControl:   pulumi.String("Git"),
    			WorkItemTemplate: pulumi.String("Agile"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = azuredevops.NewGit(ctx, "example", &azuredevops.GitArgs{
    			ProjectId:     example.ID(),
    			Name:          pulumi.String("Example Git Repository"),
    			DefaultBranch: pulumi.String("refs/heads/main"),
    			Initialization: &azuredevops.GitInitializationArgs{
    				InitType: pulumi.String("Clean"),
    			},
    		})
    		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 = new AzureDevOps.Project("example", new()
        {
            Name = "Example Project",
            Visibility = "private",
            VersionControl = "Git",
            WorkItemTemplate = "Agile",
        });
    
        var exampleGit = new AzureDevOps.Git("example", new()
        {
            ProjectId = example.Id,
            Name = "Example Git Repository",
            DefaultBranch = "refs/heads/main",
            Initialization = new AzureDevOps.Inputs.GitInitializationArgs
            {
                InitType = "Clean",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.azuredevops.Project;
    import com.pulumi.azuredevops.ProjectArgs;
    import com.pulumi.azuredevops.Git;
    import com.pulumi.azuredevops.GitArgs;
    import com.pulumi.azuredevops.inputs.GitInitializationArgs;
    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) {
            var example = new Project("example", ProjectArgs.builder()
                .name("Example Project")
                .visibility("private")
                .versionControl("Git")
                .workItemTemplate("Agile")
                .build());
    
            var exampleGit = new Git("exampleGit", GitArgs.builder()
                .projectId(example.id())
                .name("Example Git Repository")
                .defaultBranch("refs/heads/main")
                .initialization(GitInitializationArgs.builder()
                    .initType("Clean")
                    .build())
                .build());
    
        }
    }
    
    resources:
      example:
        type: azuredevops:Project
        properties:
          name: Example Project
          visibility: private
          versionControl: Git
          workItemTemplate: Agile
      exampleGit:
        type: azuredevops:Git
        name: example
        properties:
          projectId: ${example.id}
          name: Example Git Repository
          defaultBranch: refs/heads/main
          initialization:
            initType: Clean
    

    Example Usage

    Create Git repository

    import * as pulumi from "@pulumi/pulumi";
    import * as azuredevops from "@pulumi/azuredevops";
    
    const example = new azuredevops.Project("example", {
        name: "Example Project",
        visibility: "private",
        versionControl: "Git",
        workItemTemplate: "Agile",
    });
    const exampleGit = new azuredevops.Git("example", {
        projectId: example.id,
        name: "Example Empty Git Repository",
        initialization: {
            initType: "Clean",
        },
    });
    
    import pulumi
    import pulumi_azuredevops as azuredevops
    
    example = azuredevops.Project("example",
        name="Example Project",
        visibility="private",
        version_control="Git",
        work_item_template="Agile")
    example_git = azuredevops.Git("example",
        project_id=example.id,
        name="Example Empty Git Repository",
        initialization={
            "init_type": "Clean",
        })
    
    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.NewProject(ctx, "example", &azuredevops.ProjectArgs{
    			Name:             pulumi.String("Example Project"),
    			Visibility:       pulumi.String("private"),
    			VersionControl:   pulumi.String("Git"),
    			WorkItemTemplate: pulumi.String("Agile"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = azuredevops.NewGit(ctx, "example", &azuredevops.GitArgs{
    			ProjectId: example.ID(),
    			Name:      pulumi.String("Example Empty Git Repository"),
    			Initialization: &azuredevops.GitInitializationArgs{
    				InitType: pulumi.String("Clean"),
    			},
    		})
    		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 = new AzureDevOps.Project("example", new()
        {
            Name = "Example Project",
            Visibility = "private",
            VersionControl = "Git",
            WorkItemTemplate = "Agile",
        });
    
        var exampleGit = new AzureDevOps.Git("example", new()
        {
            ProjectId = example.Id,
            Name = "Example Empty Git Repository",
            Initialization = new AzureDevOps.Inputs.GitInitializationArgs
            {
                InitType = "Clean",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.azuredevops.Project;
    import com.pulumi.azuredevops.ProjectArgs;
    import com.pulumi.azuredevops.Git;
    import com.pulumi.azuredevops.GitArgs;
    import com.pulumi.azuredevops.inputs.GitInitializationArgs;
    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) {
            var example = new Project("example", ProjectArgs.builder()
                .name("Example Project")
                .visibility("private")
                .versionControl("Git")
                .workItemTemplate("Agile")
                .build());
    
            var exampleGit = new Git("exampleGit", GitArgs.builder()
                .projectId(example.id())
                .name("Example Empty Git Repository")
                .initialization(GitInitializationArgs.builder()
                    .initType("Clean")
                    .build())
                .build());
    
        }
    }
    
    resources:
      example:
        type: azuredevops:Project
        properties:
          name: Example Project
          visibility: private
          versionControl: Git
          workItemTemplate: Agile
      exampleGit:
        type: azuredevops:Git
        name: example
        properties:
          projectId: ${example.id}
          name: Example Empty Git Repository
          initialization:
            initType: Clean
    

    Configure existing Git repository imported into Terraform state

    import * as pulumi from "@pulumi/pulumi";
    import * as azuredevops from "@pulumi/azuredevops";
    
    const example = new azuredevops.Project("example", {
        name: "Example Project",
        visibility: "private",
        versionControl: "Git",
        workItemTemplate: "Agile",
    });
    const exampleGit = new azuredevops.Git("example", {
        projectId: example.id,
        name: "Example Git Repository",
        defaultBranch: "refs/heads/main",
        initialization: {
            initType: "Clean",
        },
    });
    
    import pulumi
    import pulumi_azuredevops as azuredevops
    
    example = azuredevops.Project("example",
        name="Example Project",
        visibility="private",
        version_control="Git",
        work_item_template="Agile")
    example_git = azuredevops.Git("example",
        project_id=example.id,
        name="Example Git Repository",
        default_branch="refs/heads/main",
        initialization={
            "init_type": "Clean",
        })
    
    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.NewProject(ctx, "example", &azuredevops.ProjectArgs{
    			Name:             pulumi.String("Example Project"),
    			Visibility:       pulumi.String("private"),
    			VersionControl:   pulumi.String("Git"),
    			WorkItemTemplate: pulumi.String("Agile"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = azuredevops.NewGit(ctx, "example", &azuredevops.GitArgs{
    			ProjectId:     example.ID(),
    			Name:          pulumi.String("Example Git Repository"),
    			DefaultBranch: pulumi.String("refs/heads/main"),
    			Initialization: &azuredevops.GitInitializationArgs{
    				InitType: pulumi.String("Clean"),
    			},
    		})
    		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 = new AzureDevOps.Project("example", new()
        {
            Name = "Example Project",
            Visibility = "private",
            VersionControl = "Git",
            WorkItemTemplate = "Agile",
        });
    
        var exampleGit = new AzureDevOps.Git("example", new()
        {
            ProjectId = example.Id,
            Name = "Example Git Repository",
            DefaultBranch = "refs/heads/main",
            Initialization = new AzureDevOps.Inputs.GitInitializationArgs
            {
                InitType = "Clean",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.azuredevops.Project;
    import com.pulumi.azuredevops.ProjectArgs;
    import com.pulumi.azuredevops.Git;
    import com.pulumi.azuredevops.GitArgs;
    import com.pulumi.azuredevops.inputs.GitInitializationArgs;
    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) {
            var example = new Project("example", ProjectArgs.builder()
                .name("Example Project")
                .visibility("private")
                .versionControl("Git")
                .workItemTemplate("Agile")
                .build());
    
            var exampleGit = new Git("exampleGit", GitArgs.builder()
                .projectId(example.id())
                .name("Example Git Repository")
                .defaultBranch("refs/heads/main")
                .initialization(GitInitializationArgs.builder()
                    .initType("Clean")
                    .build())
                .build());
    
        }
    }
    
    resources:
      example:
        type: azuredevops:Project
        properties:
          name: Example Project
          visibility: private
          versionControl: Git
          workItemTemplate: Agile
      exampleGit:
        type: azuredevops:Git
        name: example
        properties:
          projectId: ${example.id}
          name: Example Git Repository
          defaultBranch: refs/heads/main
          initialization:
            initType: Clean
    

    Create Fork of another Azure DevOps Git repository

    import * as pulumi from "@pulumi/pulumi";
    import * as azuredevops from "@pulumi/azuredevops";
    
    const example = new azuredevops.Project("example", {
        name: "Example Project",
        visibility: "private",
        versionControl: "Git",
        workItemTemplate: "Agile",
    });
    const exampleGit = new azuredevops.Git("example", {
        projectId: example.id,
        name: "Example Git Repository",
        defaultBranch: "refs/heads/main",
        initialization: {
            initType: "Clean",
        },
    });
    const example_fork = new azuredevops.Git("example-fork", {
        projectId: example.id,
        name: "Example Fork Repository",
        parentRepositoryId: exampleGit.id,
        initialization: {
            initType: "Fork",
        },
    });
    
    import pulumi
    import pulumi_azuredevops as azuredevops
    
    example = azuredevops.Project("example",
        name="Example Project",
        visibility="private",
        version_control="Git",
        work_item_template="Agile")
    example_git = azuredevops.Git("example",
        project_id=example.id,
        name="Example Git Repository",
        default_branch="refs/heads/main",
        initialization={
            "init_type": "Clean",
        })
    example_fork = azuredevops.Git("example-fork",
        project_id=example.id,
        name="Example Fork Repository",
        parent_repository_id=example_git.id,
        initialization={
            "init_type": "Fork",
        })
    
    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.NewProject(ctx, "example", &azuredevops.ProjectArgs{
    			Name:             pulumi.String("Example Project"),
    			Visibility:       pulumi.String("private"),
    			VersionControl:   pulumi.String("Git"),
    			WorkItemTemplate: pulumi.String("Agile"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleGit, err := azuredevops.NewGit(ctx, "example", &azuredevops.GitArgs{
    			ProjectId:     example.ID(),
    			Name:          pulumi.String("Example Git Repository"),
    			DefaultBranch: pulumi.String("refs/heads/main"),
    			Initialization: &azuredevops.GitInitializationArgs{
    				InitType: pulumi.String("Clean"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = azuredevops.NewGit(ctx, "example-fork", &azuredevops.GitArgs{
    			ProjectId:          example.ID(),
    			Name:               pulumi.String("Example Fork Repository"),
    			ParentRepositoryId: exampleGit.ID(),
    			Initialization: &azuredevops.GitInitializationArgs{
    				InitType: pulumi.String("Fork"),
    			},
    		})
    		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 = new AzureDevOps.Project("example", new()
        {
            Name = "Example Project",
            Visibility = "private",
            VersionControl = "Git",
            WorkItemTemplate = "Agile",
        });
    
        var exampleGit = new AzureDevOps.Git("example", new()
        {
            ProjectId = example.Id,
            Name = "Example Git Repository",
            DefaultBranch = "refs/heads/main",
            Initialization = new AzureDevOps.Inputs.GitInitializationArgs
            {
                InitType = "Clean",
            },
        });
    
        var example_fork = new AzureDevOps.Git("example-fork", new()
        {
            ProjectId = example.Id,
            Name = "Example Fork Repository",
            ParentRepositoryId = exampleGit.Id,
            Initialization = new AzureDevOps.Inputs.GitInitializationArgs
            {
                InitType = "Fork",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.azuredevops.Project;
    import com.pulumi.azuredevops.ProjectArgs;
    import com.pulumi.azuredevops.Git;
    import com.pulumi.azuredevops.GitArgs;
    import com.pulumi.azuredevops.inputs.GitInitializationArgs;
    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) {
            var example = new Project("example", ProjectArgs.builder()
                .name("Example Project")
                .visibility("private")
                .versionControl("Git")
                .workItemTemplate("Agile")
                .build());
    
            var exampleGit = new Git("exampleGit", GitArgs.builder()
                .projectId(example.id())
                .name("Example Git Repository")
                .defaultBranch("refs/heads/main")
                .initialization(GitInitializationArgs.builder()
                    .initType("Clean")
                    .build())
                .build());
    
            var example_fork = new Git("example-fork", GitArgs.builder()
                .projectId(example.id())
                .name("Example Fork Repository")
                .parentRepositoryId(exampleGit.id())
                .initialization(GitInitializationArgs.builder()
                    .initType("Fork")
                    .build())
                .build());
    
        }
    }
    
    resources:
      example:
        type: azuredevops:Project
        properties:
          name: Example Project
          visibility: private
          versionControl: Git
          workItemTemplate: Agile
      exampleGit:
        type: azuredevops:Git
        name: example
        properties:
          projectId: ${example.id}
          name: Example Git Repository
          defaultBranch: refs/heads/main
          initialization:
            initType: Clean
      example-fork:
        type: azuredevops:Git
        properties:
          projectId: ${example.id}
          name: Example Fork Repository
          parentRepositoryId: ${exampleGit.id}
          initialization:
            initType: Fork
    

    Create Import from another Git repository

    import * as pulumi from "@pulumi/pulumi";
    import * as azuredevops from "@pulumi/azuredevops";
    
    const example = new azuredevops.Project("example", {
        name: "Example Project",
        visibility: "private",
        versionControl: "Git",
        workItemTemplate: "Agile",
    });
    const exampleGit = new azuredevops.Git("example", {
        projectId: example.id,
        name: "Example Git Repository",
        defaultBranch: "refs/heads/main",
        initialization: {
            initType: "Clean",
        },
    });
    const example_import = new azuredevops.Git("example-import", {
        projectId: example.id,
        name: "Example Import Repository",
        initialization: {
            initType: "Import",
            sourceType: "Git",
            sourceUrl: "https://github.com/microsoft/terraform-provider-azuredevops.git",
        },
    });
    
    import pulumi
    import pulumi_azuredevops as azuredevops
    
    example = azuredevops.Project("example",
        name="Example Project",
        visibility="private",
        version_control="Git",
        work_item_template="Agile")
    example_git = azuredevops.Git("example",
        project_id=example.id,
        name="Example Git Repository",
        default_branch="refs/heads/main",
        initialization={
            "init_type": "Clean",
        })
    example_import = azuredevops.Git("example-import",
        project_id=example.id,
        name="Example Import Repository",
        initialization={
            "init_type": "Import",
            "source_type": "Git",
            "source_url": "https://github.com/microsoft/terraform-provider-azuredevops.git",
        })
    
    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.NewProject(ctx, "example", &azuredevops.ProjectArgs{
    			Name:             pulumi.String("Example Project"),
    			Visibility:       pulumi.String("private"),
    			VersionControl:   pulumi.String("Git"),
    			WorkItemTemplate: pulumi.String("Agile"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = azuredevops.NewGit(ctx, "example", &azuredevops.GitArgs{
    			ProjectId:     example.ID(),
    			Name:          pulumi.String("Example Git Repository"),
    			DefaultBranch: pulumi.String("refs/heads/main"),
    			Initialization: &azuredevops.GitInitializationArgs{
    				InitType: pulumi.String("Clean"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = azuredevops.NewGit(ctx, "example-import", &azuredevops.GitArgs{
    			ProjectId: example.ID(),
    			Name:      pulumi.String("Example Import Repository"),
    			Initialization: &azuredevops.GitInitializationArgs{
    				InitType:   pulumi.String("Import"),
    				SourceType: pulumi.String("Git"),
    				SourceUrl:  pulumi.String("https://github.com/microsoft/terraform-provider-azuredevops.git"),
    			},
    		})
    		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 = new AzureDevOps.Project("example", new()
        {
            Name = "Example Project",
            Visibility = "private",
            VersionControl = "Git",
            WorkItemTemplate = "Agile",
        });
    
        var exampleGit = new AzureDevOps.Git("example", new()
        {
            ProjectId = example.Id,
            Name = "Example Git Repository",
            DefaultBranch = "refs/heads/main",
            Initialization = new AzureDevOps.Inputs.GitInitializationArgs
            {
                InitType = "Clean",
            },
        });
    
        var example_import = new AzureDevOps.Git("example-import", new()
        {
            ProjectId = example.Id,
            Name = "Example Import Repository",
            Initialization = new AzureDevOps.Inputs.GitInitializationArgs
            {
                InitType = "Import",
                SourceType = "Git",
                SourceUrl = "https://github.com/microsoft/terraform-provider-azuredevops.git",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.azuredevops.Project;
    import com.pulumi.azuredevops.ProjectArgs;
    import com.pulumi.azuredevops.Git;
    import com.pulumi.azuredevops.GitArgs;
    import com.pulumi.azuredevops.inputs.GitInitializationArgs;
    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) {
            var example = new Project("example", ProjectArgs.builder()
                .name("Example Project")
                .visibility("private")
                .versionControl("Git")
                .workItemTemplate("Agile")
                .build());
    
            var exampleGit = new Git("exampleGit", GitArgs.builder()
                .projectId(example.id())
                .name("Example Git Repository")
                .defaultBranch("refs/heads/main")
                .initialization(GitInitializationArgs.builder()
                    .initType("Clean")
                    .build())
                .build());
    
            var example_import = new Git("example-import", GitArgs.builder()
                .projectId(example.id())
                .name("Example Import Repository")
                .initialization(GitInitializationArgs.builder()
                    .initType("Import")
                    .sourceType("Git")
                    .sourceUrl("https://github.com/microsoft/terraform-provider-azuredevops.git")
                    .build())
                .build());
    
        }
    }
    
    resources:
      example:
        type: azuredevops:Project
        properties:
          name: Example Project
          visibility: private
          versionControl: Git
          workItemTemplate: Agile
      exampleGit:
        type: azuredevops:Git
        name: example
        properties:
          projectId: ${example.id}
          name: Example Git Repository
          defaultBranch: refs/heads/main
          initialization:
            initType: Clean
      example-import:
        type: azuredevops:Git
        properties:
          projectId: ${example.id}
          name: Example Import Repository
          initialization:
            initType: Import
            sourceType: Git
            sourceUrl: https://github.com/microsoft/terraform-provider-azuredevops.git
    

    Import from a Private Repository

    import * as pulumi from "@pulumi/pulumi";
    import * as azuredevops from "@pulumi/azuredevops";
    
    const example = new azuredevops.Project("example", {
        name: "Example Project",
        visibility: "private",
        versionControl: "Git",
        workItemTemplate: "Agile",
    });
    const exampleGit = new azuredevops.Git("example", {
        projectId: example.id,
        name: "Example Git Repository",
        defaultBranch: "refs/heads/main",
        initialization: {
            initType: "Clean",
        },
    });
    const example_serviceendpoint = new azuredevops.ServiceEndpointGenericGit("example-serviceendpoint", {
        projectId: example.id,
        repositoryUrl: "https://dev.azure.com/org/project/_git/repository",
        username: "username",
        password: "<password>/<PAT>",
        serviceEndpointName: "Example Generic Git",
        description: "Managed by Pulumi",
    });
    // with service connection
    const example_import = new azuredevops.Git("example-import", {
        projectId: example.id,
        name: "Example Import Existing Repository",
        initialization: {
            initType: "Import",
            sourceType: "Git",
            sourceUrl: "https://dev.azure.com/example-org/private-repository.git",
            serviceConnectionId: example_serviceendpoint.id,
        },
    });
    // with username/password
    const example_import2 = new azuredevops.Git("example-import2", {
        projectId: example.id,
        name: "Example Import Existing Repository",
        initialization: {
            initType: "Import",
            sourceType: "Git",
            sourceUrl: "https://dev.azure.com/example-org/private-repository.git",
            username: "username",
            password: "password",
        },
    });
    
    import pulumi
    import pulumi_azuredevops as azuredevops
    
    example = azuredevops.Project("example",
        name="Example Project",
        visibility="private",
        version_control="Git",
        work_item_template="Agile")
    example_git = azuredevops.Git("example",
        project_id=example.id,
        name="Example Git Repository",
        default_branch="refs/heads/main",
        initialization={
            "init_type": "Clean",
        })
    example_serviceendpoint = azuredevops.ServiceEndpointGenericGit("example-serviceendpoint",
        project_id=example.id,
        repository_url="https://dev.azure.com/org/project/_git/repository",
        username="username",
        password="<password>/<PAT>",
        service_endpoint_name="Example Generic Git",
        description="Managed by Pulumi")
    # with service connection
    example_import = azuredevops.Git("example-import",
        project_id=example.id,
        name="Example Import Existing Repository",
        initialization={
            "init_type": "Import",
            "source_type": "Git",
            "source_url": "https://dev.azure.com/example-org/private-repository.git",
            "service_connection_id": example_serviceendpoint.id,
        })
    # with username/password
    example_import2 = azuredevops.Git("example-import2",
        project_id=example.id,
        name="Example Import Existing Repository",
        initialization={
            "init_type": "Import",
            "source_type": "Git",
            "source_url": "https://dev.azure.com/example-org/private-repository.git",
            "username": "username",
            "password": "password",
        })
    
    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.NewProject(ctx, "example", &azuredevops.ProjectArgs{
    			Name:             pulumi.String("Example Project"),
    			Visibility:       pulumi.String("private"),
    			VersionControl:   pulumi.String("Git"),
    			WorkItemTemplate: pulumi.String("Agile"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = azuredevops.NewGit(ctx, "example", &azuredevops.GitArgs{
    			ProjectId:     example.ID(),
    			Name:          pulumi.String("Example Git Repository"),
    			DefaultBranch: pulumi.String("refs/heads/main"),
    			Initialization: &azuredevops.GitInitializationArgs{
    				InitType: pulumi.String("Clean"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		example_serviceendpoint, err := azuredevops.NewServiceEndpointGenericGit(ctx, "example-serviceendpoint", &azuredevops.ServiceEndpointGenericGitArgs{
    			ProjectId:           example.ID(),
    			RepositoryUrl:       pulumi.String("https://dev.azure.com/org/project/_git/repository"),
    			Username:            pulumi.String("username"),
    			Password:            pulumi.String("<password>/<PAT>"),
    			ServiceEndpointName: pulumi.String("Example Generic Git"),
    			Description:         pulumi.String("Managed by Pulumi"),
    		})
    		if err != nil {
    			return err
    		}
    		// with service connection
    		_, err = azuredevops.NewGit(ctx, "example-import", &azuredevops.GitArgs{
    			ProjectId: example.ID(),
    			Name:      pulumi.String("Example Import Existing Repository"),
    			Initialization: &azuredevops.GitInitializationArgs{
    				InitType:            pulumi.String("Import"),
    				SourceType:          pulumi.String("Git"),
    				SourceUrl:           pulumi.String("https://dev.azure.com/example-org/private-repository.git"),
    				ServiceConnectionId: example_serviceendpoint.ID(),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		// with username/password
    		_, err = azuredevops.NewGit(ctx, "example-import2", &azuredevops.GitArgs{
    			ProjectId: example.ID(),
    			Name:      pulumi.String("Example Import Existing Repository"),
    			Initialization: &azuredevops.GitInitializationArgs{
    				InitType:   pulumi.String("Import"),
    				SourceType: pulumi.String("Git"),
    				SourceUrl:  pulumi.String("https://dev.azure.com/example-org/private-repository.git"),
    				Username:   pulumi.String("username"),
    				Password:   pulumi.String("password"),
    			},
    		})
    		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 = new AzureDevOps.Project("example", new()
        {
            Name = "Example Project",
            Visibility = "private",
            VersionControl = "Git",
            WorkItemTemplate = "Agile",
        });
    
        var exampleGit = new AzureDevOps.Git("example", new()
        {
            ProjectId = example.Id,
            Name = "Example Git Repository",
            DefaultBranch = "refs/heads/main",
            Initialization = new AzureDevOps.Inputs.GitInitializationArgs
            {
                InitType = "Clean",
            },
        });
    
        var example_serviceendpoint = new AzureDevOps.ServiceEndpointGenericGit("example-serviceendpoint", new()
        {
            ProjectId = example.Id,
            RepositoryUrl = "https://dev.azure.com/org/project/_git/repository",
            Username = "username",
            Password = "<password>/<PAT>",
            ServiceEndpointName = "Example Generic Git",
            Description = "Managed by Pulumi",
        });
    
        // with service connection
        var example_import = new AzureDevOps.Git("example-import", new()
        {
            ProjectId = example.Id,
            Name = "Example Import Existing Repository",
            Initialization = new AzureDevOps.Inputs.GitInitializationArgs
            {
                InitType = "Import",
                SourceType = "Git",
                SourceUrl = "https://dev.azure.com/example-org/private-repository.git",
                ServiceConnectionId = example_serviceendpoint.Id,
            },
        });
    
        // with username/password
        var example_import2 = new AzureDevOps.Git("example-import2", new()
        {
            ProjectId = example.Id,
            Name = "Example Import Existing Repository",
            Initialization = new AzureDevOps.Inputs.GitInitializationArgs
            {
                InitType = "Import",
                SourceType = "Git",
                SourceUrl = "https://dev.azure.com/example-org/private-repository.git",
                Username = "username",
                Password = "password",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.azuredevops.Project;
    import com.pulumi.azuredevops.ProjectArgs;
    import com.pulumi.azuredevops.Git;
    import com.pulumi.azuredevops.GitArgs;
    import com.pulumi.azuredevops.inputs.GitInitializationArgs;
    import com.pulumi.azuredevops.ServiceEndpointGenericGit;
    import com.pulumi.azuredevops.ServiceEndpointGenericGitArgs;
    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) {
            var example = new Project("example", ProjectArgs.builder()
                .name("Example Project")
                .visibility("private")
                .versionControl("Git")
                .workItemTemplate("Agile")
                .build());
    
            var exampleGit = new Git("exampleGit", GitArgs.builder()
                .projectId(example.id())
                .name("Example Git Repository")
                .defaultBranch("refs/heads/main")
                .initialization(GitInitializationArgs.builder()
                    .initType("Clean")
                    .build())
                .build());
    
            var example_serviceendpoint = new ServiceEndpointGenericGit("example-serviceendpoint", ServiceEndpointGenericGitArgs.builder()
                .projectId(example.id())
                .repositoryUrl("https://dev.azure.com/org/project/_git/repository")
                .username("username")
                .password("<password>/<PAT>")
                .serviceEndpointName("Example Generic Git")
                .description("Managed by Pulumi")
                .build());
    
            // with service connection
            var example_import = new Git("example-import", GitArgs.builder()
                .projectId(example.id())
                .name("Example Import Existing Repository")
                .initialization(GitInitializationArgs.builder()
                    .initType("Import")
                    .sourceType("Git")
                    .sourceUrl("https://dev.azure.com/example-org/private-repository.git")
                    .serviceConnectionId(example_serviceendpoint.id())
                    .build())
                .build());
    
            // with username/password
            var example_import2 = new Git("example-import2", GitArgs.builder()
                .projectId(example.id())
                .name("Example Import Existing Repository")
                .initialization(GitInitializationArgs.builder()
                    .initType("Import")
                    .sourceType("Git")
                    .sourceUrl("https://dev.azure.com/example-org/private-repository.git")
                    .username("username")
                    .password("password")
                    .build())
                .build());
    
        }
    }
    
    resources:
      example:
        type: azuredevops:Project
        properties:
          name: Example Project
          visibility: private
          versionControl: Git
          workItemTemplate: Agile
      exampleGit:
        type: azuredevops:Git
        name: example
        properties:
          projectId: ${example.id}
          name: Example Git Repository
          defaultBranch: refs/heads/main
          initialization:
            initType: Clean
      example-serviceendpoint:
        type: azuredevops:ServiceEndpointGenericGit
        properties:
          projectId: ${example.id}
          repositoryUrl: https://dev.azure.com/org/project/_git/repository
          username: username
          password: <password>/<PAT>
          serviceEndpointName: Example Generic Git
          description: Managed by Pulumi
      # with service connection
      example-import:
        type: azuredevops:Git
        properties:
          projectId: ${example.id}
          name: Example Import Existing Repository
          initialization:
            initType: Import
            sourceType: Git
            sourceUrl: https://dev.azure.com/example-org/private-repository.git
            serviceConnectionId: ${["example-serviceendpoint"].id}
      # with username/password
      example-import2:
        type: azuredevops:Git
        properties:
          projectId: ${example.id}
          name: Example Import Existing Repository
          initialization:
            initType: Import
            sourceType: Git
            sourceUrl: https://dev.azure.com/example-org/private-repository.git
            username: username
            password: password
    

    Disable a Git repository

    import * as pulumi from "@pulumi/pulumi";
    import * as azuredevops from "@pulumi/azuredevops";
    
    const example = new azuredevops.Project("example", {
        name: "Example Project",
        visibility: "private",
        versionControl: "Git",
        workItemTemplate: "Agile",
    });
    const exampleGit = new azuredevops.Git("example", {
        projectId: example.id,
        name: "Example Empty Git Repository",
        disabled: true,
        initialization: {
            initType: "Clean",
        },
    });
    
    import pulumi
    import pulumi_azuredevops as azuredevops
    
    example = azuredevops.Project("example",
        name="Example Project",
        visibility="private",
        version_control="Git",
        work_item_template="Agile")
    example_git = azuredevops.Git("example",
        project_id=example.id,
        name="Example Empty Git Repository",
        disabled=True,
        initialization={
            "init_type": "Clean",
        })
    
    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.NewProject(ctx, "example", &azuredevops.ProjectArgs{
    			Name:             pulumi.String("Example Project"),
    			Visibility:       pulumi.String("private"),
    			VersionControl:   pulumi.String("Git"),
    			WorkItemTemplate: pulumi.String("Agile"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = azuredevops.NewGit(ctx, "example", &azuredevops.GitArgs{
    			ProjectId: example.ID(),
    			Name:      pulumi.String("Example Empty Git Repository"),
    			Disabled:  pulumi.Bool(true),
    			Initialization: &azuredevops.GitInitializationArgs{
    				InitType: pulumi.String("Clean"),
    			},
    		})
    		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 = new AzureDevOps.Project("example", new()
        {
            Name = "Example Project",
            Visibility = "private",
            VersionControl = "Git",
            WorkItemTemplate = "Agile",
        });
    
        var exampleGit = new AzureDevOps.Git("example", new()
        {
            ProjectId = example.Id,
            Name = "Example Empty Git Repository",
            Disabled = true,
            Initialization = new AzureDevOps.Inputs.GitInitializationArgs
            {
                InitType = "Clean",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.azuredevops.Project;
    import com.pulumi.azuredevops.ProjectArgs;
    import com.pulumi.azuredevops.Git;
    import com.pulumi.azuredevops.GitArgs;
    import com.pulumi.azuredevops.inputs.GitInitializationArgs;
    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) {
            var example = new Project("example", ProjectArgs.builder()
                .name("Example Project")
                .visibility("private")
                .versionControl("Git")
                .workItemTemplate("Agile")
                .build());
    
            var exampleGit = new Git("exampleGit", GitArgs.builder()
                .projectId(example.id())
                .name("Example Empty Git Repository")
                .disabled(true)
                .initialization(GitInitializationArgs.builder()
                    .initType("Clean")
                    .build())
                .build());
    
        }
    }
    
    resources:
      example:
        type: azuredevops:Project
        properties:
          name: Example Project
          visibility: private
          versionControl: Git
          workItemTemplate: Agile
      exampleGit:
        type: azuredevops:Git
        name: example
        properties:
          projectId: ${example.id}
          name: Example Empty Git Repository
          disabled: true
          initialization:
            initType: Clean
    

    PAT Permissions Required

    • Code: Read, Create, & Manage.

    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 string
    The unique name of the resource.
    args GitArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args 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 string
    The unique name of the resource.
    args GitArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args GitArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args 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",
    });
    
    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"),
    })
    
    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());
    
    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")
    
    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",
    });
    
    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
    

    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 Pulumi.AzureDevOps.Inputs.GitInitialization
    A initialization block as documented below.
    ProjectId 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 GitInitializationArgs
    A initialization block as documented below.
    ProjectId 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 GitInitialization
    A initialization block as documented below.
    projectId 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 GitInitialization
    A initialization block as documented below.
    projectId 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 GitInitializationArgs
    A initialization block as documented below.
    project_id 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 Property Map
    A initialization block as documented below.
    projectId 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
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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 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 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 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 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 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 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 string
    The type of repository to create. Valid values: Uninitialized, Clean or Import.
    Password string

    NOTE: This field is write-only and its value will not be updated in state as part of read operations. The password used to authenticate to a private repository for import initialization. Conflicts with service_connection_id. Note: This is a write-only attribute, which allows ephemeral resources to be used.

    ~>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 string
    The type of repository to create. Valid values: Uninitialized, Clean or Import.
    Password string

    NOTE: This field is write-only and its value will not be updated in state as part of read operations. The password used to authenticate to a private repository for import initialization. Conflicts with service_connection_id. Note: This is a write-only attribute, which allows ephemeral resources to be used.

    ~>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 String
    The type of repository to create. Valid values: Uninitialized, Clean or Import.
    password String

    NOTE: This field is write-only and its value will not be updated in state as part of read operations. The password used to authenticate to a private repository for import initialization. Conflicts with service_connection_id. Note: This is a write-only attribute, which allows ephemeral resources to be used.

    ~>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 string
    The type of repository to create. Valid values: Uninitialized, Clean or Import.
    password string

    NOTE: This field is write-only and its value will not be updated in state as part of read operations. The password used to authenticate to a private repository for import initialization. Conflicts with service_connection_id. Note: This is a write-only attribute, which allows ephemeral resources to be used.

    ~>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 str
    The type of repository to create. Valid values: Uninitialized, Clean or Import.
    password str

    NOTE: This field is write-only and its value will not be updated in state as part of read operations. The password used to authenticate to a private repository for import initialization. Conflicts with service_connection_id. Note: This is a write-only attribute, which allows ephemeral resources to be used.

    ~>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 String
    The type of repository to create. Valid values: Uninitialized, Clean or Import.
    password String

    NOTE: This field is write-only and its value will not be updated in state as part of read operations. The password used to authenticate to a private repository for import initialization. Conflicts with service_connection_id. Note: This is a write-only attribute, which allows ephemeral resources to be used.

    ~>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.

    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
    

    or

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

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Azure DevOps pulumi/pulumi-azuredevops
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the azuredevops Terraform Provider.
    azuredevops logo
    Viewing docs for Azure DevOps v3.14.0
    published on Tuesday, Mar 24, 2026 by Pulumi
      Try Pulumi Cloud free. Your team will thank you.