aboutsummaryrefslogtreecommitdiffstats
path: root/services/mirror/mirror_push.go
diff options
context:
space:
mode:
Diffstat (limited to 'services/mirror/mirror_push.go')
-rw-r--r--services/mirror/mirror_push.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/services/mirror/mirror_push.go b/services/mirror/mirror_push.go
index cff53ba8d0..b619f9ab32 100644
--- a/services/mirror/mirror_push.go
+++ b/services/mirror/mirror_push.go
@@ -10,6 +10,7 @@ import (
"fmt"
"io"
"regexp"
+ "strings"
"time"
repo_model "code.gitea.io/gitea/models/repo"
@@ -28,7 +29,13 @@ var stripExitStatus = regexp.MustCompile(`exit status \d+ - `)
// AddPushMirrorRemote registers the push mirror remote.
func AddPushMirrorRemote(ctx context.Context, m *repo_model.PushMirror, addr string) error {
addRemoteAndConfig := func(addr, path string) error {
- if _, err := git.NewCommand(ctx, "remote", "add", "--mirror=push", m.RemoteName, addr).RunInDir(path); err != nil {
+ cmd := git.NewCommand(ctx, "remote", "add", "--mirror=push", m.RemoteName, addr)
+ if strings.Contains(addr, "://") && strings.Contains(addr, "@") {
+ cmd.SetDescription(fmt.Sprintf("remote add %s --mirror=push %s [repo_path: %s]", m.RemoteName, util.NewStringURLSanitizer(addr, true).Replace(addr), path))
+ } else {
+ cmd.SetDescription(fmt.Sprintf("remote add %s --mirror=push %s [repo_path: %s]", m.RemoteName, addr, path))
+ }
+ if _, err := cmd.RunInDir(path); err != nil {
return err
}
if _, err := git.NewCommand(ctx, "config", "--add", "remote."+m.RemoteName+".push", "+refs/heads/*:refs/heads/*").RunInDir(path); err != nil {