Go to your Azure DevOps organization. Navigate to User settings > Personal access tokens. Generate a new token with the required permissions (Code > Read & Write). Keep the generated token secure as it grants access to your Azure DevOps resources.
POST https://dev.azure.com/<organization>/_apis/git/repositories?api-version=7.1-preview.1
Postman Config to Debug (Optional)
Body
{
"name": "AnotherRepository",
"project": {
"id": "<project_id>"
}
}
Status code 201
{
"id": "5febef5a-833d-4e14-b9c0-14cb638f91e6",
"name": "AnotherRepository",
"url": "https://dev.azure.com/<organization>/_apis/git/repositories/5febef5a-833d-4e14-b9c0-14cb638f91e6",
"project": {
"id": "6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c",
"name": "Fabrikam-Fiber-Git",
"url": "https://dev.azure.com/<project_id>/_apis/projects/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c",
"state": "wellFormed",
"revision": 40,
"visibility": "private",
"lastUpdateTime": "2023-10-02T15:29:31.72Z"
},
"size": 0,
"remoteUrl": "https://dev.azure.com/<organization>/<project_id>/_git/AnotherRepository",
"sshUrl": "git@ssh.dev.azure.com:v3/<organization>/<project_id>/AnotherRepository",
"webUrl": "https://dev.azure.com/<organization>/<project_id>/_git/AnotherRepository",
"isDisabled": false,
"isInMaintenance": false
}