Is it possible to use the Visual Studio Team Services REST API to init a newly created repository?
Cant believe i missed this from the VSTS REST api documentation, but here is how you can create and init a new git repository on vsts and also tested it with TFS 2015 on-prem
Createing a new repository:
Post: http://tfs:8080/tfs/DefaultCollection/_apis/git/repositories?api-version=3.0
Body:
{
"name": "AnotherRepository",
"project": {
"id": "e7154789-27db-4ee5-a192-4d69594c6588"
}
}
Initializing the new repository:
Body:
{
"refUpdates": [
{
"name": "refs/heads/master",
"oldObjectId": "0000000000000000000000000000000000000000"
}
],
"commits": [
{
"comment": "Initial commit.",
"changes": [
{
"changeType": "add",
"item": {
"path": "/readme.md"
},
"newContent": {
"content": "My first file!",
"contentType": "rawtext"
}
}
]
}
]
}
VSTS REST Documentation: