Open xtreampb opened 6 years ago
I am having the same problem. a better example would be appreciated.
Its as simple as this sourceRef=refs/heads/master
. This article was useful and would be a good thing to reference in the documentation Git-Internals-Git-References
After a little spelunking I came up with this.
var stringContent = new StringContent(JsonConvert.SerializeObject(new
{
name = $"{name}",
parentRepository = new
{
id = parentRepositoryGuid,
project = new
{
id = projectGuid
}
},
project = new
{
id = projectGuid
}
}), Encoding.UTF8, "application/json");
var url = $"{DEVOPSBASEURL}/{projectGuid}/_apis/git/repositories?sourceRef=refs/heads/master&api-version=4.1";
Trying to follow the API for forking a repository (first step in a much larger chain). I've realized a fork is just creating a new repository with added source references. Trying to consume this api call: Git Create I'm not sure what to put for the source ref in the URL in addition to what data makes up the body of the request.
I would greatly appriciate an example on how to fork an existing repo from one project to another one, in addition to within the same project.