Create Repo

POST {{baseUrl}}/{{organization}}/{{project}}/_apis/git/repositories?api-version=6.0

This request creates a new repository named repositoryId in the given project and organization, using the auto-generated projectId. It uses password for authentication.

This request auto-generates environment variables in the format {{Repository Name}}/{{Branch Name}}/previousCommitId. See the Note underneath Environment Setup for more details.

This request also uses the variable baseRepo as part of the request URL to create the repository. The baseRepo variable allows the switching of this request from a regular POST request (which would use https://dev.azure.com) to an example generated through the Mock Server (which would use the Mock Server URL).

Request Params

KeyDatatypeRequiredDescription
api-versionstring

Request Body

{"name"=>"{{repositoryId}}", "project"=>{"id"=>"{{projectId}}"}}

HEADERS

KeyDatatypeRequiredDescription
x-mock-response-namestring

RESPONSES

status: Created

{"id":"repositoryId","name":"new_repository","url":"https://dev.azure.com/{{organization}}/{{projectId}}/_apis/git/repositories/{{repositoryId}}","project":{"id":"{{projectId}}","name":"{{project}}","url":"https://dev.azure.com/{{organization}}/_apis/projects/{{projectId}}","state":"wellFormed","revision":11,"visibility":"private","lastUpdateTime":"2021-00-00T00:00:00.00Z"},"size":0,"remoteUrl":"htps://{{organization}}@dev.azure.com/{{organization}}/{{project}}/_git/new_repository","sshUrl":"git@ssh.dev.azure.com:v3/{{organization}}/{{project}}/new_repository","webUrl":"https://dev.azure.com/{{organization}}/{{project}}/_git/new_repository","isDisabled":false}