1
我試圖通過TFS GIT REST API將子模塊添加到我在TFS上的git回購,但是到目前爲止沒有運氣。我創建了新的存儲庫並將.gitmodules添加到存儲庫,但無法弄清楚如何添加子模塊文件夾/引用。TFS Git Rest Api - 如何添加子模塊?
這是我試圖構建的名爲「SomeTools」的.gitignore,.gitmodules和子模塊的初始提交的原始請求。
POST http://tfs:8080/tfs/My_Collection/My_Projekt/_apis/git/repositories/TestRepo/pushes?api-version=2.0 HTTP/1.1
Accept: */*
Content-Type: application/json
Host: tfs:8080
Content-Length: 7213
{
"refUpdates": [
{
"name": "refs/heads/develop",
"oldObjectId": "0000000000000000000000000000000000000000"
}
],
"commits": [
{
"changes": [
{
"newContent": {
"content": *.suo\r\n",
"contentType": "rawtext"
},
"changeType": "add",
"item": {
"path": "/.gitignore"
}
},
{
"newContent": {
"content": "[submodule \"SomeTools\"]\n\tpath = SomeTools\n\turl = http://tfs:8080/tfs/My_Collection/My_Projekt/_git/SomeTools\n",
"contentType": "rawtext"
},
"changeType": "add",
"item": {
"path": "/.gitmodules"
}
},
{
"newContent": {
"content": "198abf113d8baf48aa55ab1897b30fdb7b23c4cc",
"contentType": "rawtext"
},
"changeType": "add",
"item": {
"path": "/SomeTools",
"versionType": "commit"
}
}
],
"comment": "Initial commit."
}
]
}
@Wojciech Markowski有你在上面的解決方法解決這個問題?任何更新? –
不幸的是,我找不到通過rest api解決問題的方法。我必須使用git local repository來添加子模塊,並按照上面所述將它推送到TFS,但是我希望web api將在短時間內得到改進以支持此功能。 –