Creates a new initial commit in a specified Azure DevOps repository.
New-AdoPushInitialCommit [[-CollectionUri] <string>] [[-ProjectName] <string>]
[-RepositoryName] <string> [[-BranchName] <string>] [[-Message] <string>] [[-Files] <Object[]>]
[[-Version] <string>] [-WhatIf] [-Confirm] [<CommonParameters>]
This cmdlet has the following aliases,
- N/A
This cmdlet allows you to create an initial commit in a specified Azure DevOps repository. You can specify the content of the commit, the commit message, and the branch to which the commit will be pushed.
$params = @{
CollectionUri = '<https://dev.azure.com/my-org>'
ProjectName = 'my-project-1'
RepositoryName = 'my-repository-1'
BranchName = 'main'
Message = 'Initial commit'
Files = @(
@{
path = '/README.md'
content = (Get-Content -Path 'C:/_tmp/README.md' -Raw)
contentType = 'rawtext'
},
@{
path = '/devops/pipeline/ci.yml'
content = (Get-Content -Path 'C:/_tmp/ci.yml' -Raw)
contentType = 'rawtext'
},
@{
path = '/.assets/tools.zip'
content = [Convert]::ToBase64String([IO.File]::ReadAllBytes('C:/_tmp/tools.zip'))
contentType = 'base64encoded'
}
)
}
New-AdoPushInitialCommit @paramsCreates a new initial commit with the specified content in the specified repository and branch.
Optional. The name of the branch to which the initial commit will be pushed. Default is 'main'.
Type: System.String
DefaultValue: main
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 3
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: true
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''Optional. The collection URI of the Azure DevOps collection/organization, e.g., https://dev.azure.com/my-org.
Type: System.String
DefaultValue: $env:DefaultAdoCollectionUri
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 0
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: true
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''Prompts you for confirmation before running the cmdlet.
Type: System.Management.Automation.SwitchParameter
DefaultValue: ''
SupportsWildcards: false
Aliases:
- cf
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''Optional. An array of file objects to include in the initial commit. Each file object should have the following properties:
- path: The path to the file in the repository.
- content: The content of the file.
- contentType: The type of content ('rawtext' or 'base64encoded').
Default is a single file with path '/README.md' and content '# Initial Commit'.
Type: System.Object[]
DefaultValue: >-
@(
@{
path = '/README.md'
content = '# Initial Commit'
contentType = 'rawtext'
}
)
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 5
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: true
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''Optional. The commit message for the initial commit. Default is 'Initial commit'.
Type: System.String
DefaultValue: Initial commit
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 4
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: true
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''Mandatory. The ID or name of the project.
Type: System.String
DefaultValue: $env:DefaultAdoProject
SupportsWildcards: false
Aliases:
- ProjectId
ParameterSets:
- Name: (All)
Position: 1
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: true
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''Mandatory. The name or ID of the repository.
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases:
- RepositoryId
ParameterSets:
- Name: (All)
Position: 2
IsRequired: true
ValueFromPipeline: true
ValueFromPipelineByPropertyName: true
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''Optional. The API version to use for the request. Default is '7.1'.
Type: System.String
DefaultValue: 7.1
SupportsWildcards: false
Aliases:
- ApiVersion
ParameterSets:
- Name: (All)
Position: 6
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''Runs the command in a mode that only reports what would happen without performing the actions.
Type: System.Management.Automation.SwitchParameter
DefaultValue: ''
SupportsWildcards: false
Aliases:
- wi
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
- N/A
- N/A