diff --git a/services/repository/push.go b/services/repository/push.go index e9f111b3b726..2e7f1a15215c 100644 --- a/services/repository/push.go +++ b/services/repository/push.go @@ -131,7 +131,7 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error { if repo.IsEmpty { // Change default branch and empty status only if pushed ref is non-empty branch. repo.DefaultBranch = refName repo.IsEmpty = false - if refName != "master" { + if repo.DefaultBranch != setting.Repository.DefaultBranch { if err := gitRepo.SetDefaultBranch(repo.DefaultBranch); err != nil { if !git.IsErrUnsupportedVersion(err) { return err