github - GIT | Set default branch using org.kohsuke java API -


i exploring org.kohsuke java api perform git operations.i create git repo , created branch well. not finding way set branch created default branch in git using java api. can assist me on this. please find code snippet below

ghorganization organization = github.getorganization(organizationname) map<string,ghteam> teams = organization.teams ghrepository repo = organization.createrepository reponame, null, null, teams.'backend-developers', true  ghcontentupdateresponse commitresponse = repo.createcontent "read me "+reponame, "readm me "+reponame, "readme.md" repo.createref("refs/heads/testbranch", commitresponse.getcommit().getsha1()) //creating test branch here working. //but below line doesn't work repo.setdefaultbranch "refs/heads/testbranch" 

i believe have right idea; appear though original snippet missing parentheses. said,

repo.setdefaultbranch("branch-name");

is correct kohsuke's github api 1.76 (and later); not know if worked in versions prior that.

additionally, possible code create branch not working expected. branch appear in github?


Comments

Popular posts from this blog

Capture and play voice with Asterisk ARI -

c++ - Can not find the "fiostream.h" file -

visual studio - Installing Packages through Nuget - "Central Directory corrupt" -