diff --git a/modules/repository/create.go b/modules/repository/create.go index 2f7d10f0d11..0aafb7c21a4 100644 --- a/modules/repository/create.go +++ b/modules/repository/create.go @@ -23,6 +23,10 @@ func CreateRepository(doer, u *models.User, opts models.CreateRepoOptions) (_ *m } } + if len(opts.DefaultBranch) == 0 { + opts.DefaultBranch = setting.Repository.DefaultBranch + } + repo := &models.Repository{ OwnerID: u.ID, Owner: u,