From 6eb3c05cb76008cbf0eec7dd94546bd446e48f30 Mon Sep 17 00:00:00 2001
From: 99rgosse <61579380+99rgosse@users.noreply.github.com>
Date: Tue, 3 May 2022 14:36:58 +0200
Subject: [PATCH] Avoid MoreThanOne Error (#19557) (#19591)

Backport #19557
---
 services/repository/branch.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/services/repository/branch.go b/services/repository/branch.go
index f16e3eca0a..272970c629 100644
--- a/services/repository/branch.go
+++ b/services/repository/branch.go
@@ -35,7 +35,7 @@ func CreateNewBranch(doer *user_model.User, repo *repo_model.Repository, oldBran
 
 	if err := git.Push(git.DefaultContext, repo.RepoPath(), git.PushOptions{
 		Remote: repo.RepoPath(),
-		Branch: fmt.Sprintf("%s:%s%s", oldBranchName, git.BranchPrefix, branchName),
+		Branch: fmt.Sprintf("%s%s:%s%s", git.BranchPrefix, oldBranchName, git.BranchPrefix, branchName),
 		Env:    models.PushingEnvironment(doer, repo),
 	}); err != nil {
 		if git.IsErrPushOutOfDate(err) || git.IsErrPushRejected(err) {