gitlab4j-api
gitlab4j-api copied to clipboard
projectAPI add readme?
How to create a readme and create a default 'master' branch when creating a project
@fengshaokun I have created an example of how to create a new project with the default readme. Does it answer your question?
public class ReadmeExample {
public static void main(String[] args) throws GitLabApiException {
final String url = "http://localhost:8090";
final String personalAccessToken = "glpat-";
GitLabApi gitLabApi = new GitLabApi(url, personalAccessToken);
Project project = new Project().withNamespaceId(1L).withName("Project Name").withDefaultBranch("main").withInitializeWithReadme(true);
gitLabApi.getProjectApi().createProject(project);
}
}