From edff571aa927f3c412ce91976e248ad4569b0c77 Mon Sep 17 00:00:00 2001
From: 99rgosse <61579380+99rgosse@users.noreply.github.com>
Date: Sun, 1 May 2022 03:09:59 +0200
Subject: [PATCH] Avoid MoreThanOne Error (#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 6667cdee61..d9fc47c63a 100644
--- a/services/repository/branch.go
+++ b/services/repository/branch.go
@@ -35,7 +35,7 @@ func CreateNewBranch(ctx context.Context, doer *user_model.User, repo *repo_mode
 
 	if err := git.Push(ctx, 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) {