summaryrefslogtreecommitdiffstats
path: root/modules/migrations/gitea.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-08-21 04:21:07 +0800
committerzeripath <art27@cantab.net>2019-08-20 21:21:07 +0100
commited58919bfc7ba467492a28cd55446c6259f07baa (patch)
tree1f77462129fceeaeca7725033f65ec2c26cdc41a /modules/migrations/gitea.go
parent3ac45e3cb58c81941618be69d40a0e2ea39080bf (diff)
downloadgitea-ed58919bfc7ba467492a28cd55446c6259f07baa.tar.gz
gitea-ed58919bfc7ba467492a28cd55446c6259f07baa.zip
fix bug when migrating a private repository (#7917)
Diffstat (limited to 'modules/migrations/gitea.go')
-rw-r--r--modules/migrations/gitea.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/modules/migrations/gitea.go b/modules/migrations/gitea.go
index ddfc2ca271..271c5616a7 100644
--- a/modules/migrations/gitea.go
+++ b/modules/migrations/gitea.go
@@ -9,6 +9,7 @@ import (
"fmt"
"io"
"net/http"
+ "net/url"
"os"
"path"
"path/filepath"
@@ -79,12 +80,22 @@ func (g *GiteaLocalUploader) CreateRepo(repo *base.Repository, opts base.Migrate
return err
}
+ var remoteAddr = repo.CloneURL
+ if len(opts.AuthUsername) > 0 {
+ u, err := url.Parse(repo.CloneURL)
+ if err != nil {
+ return err
+ }
+ u.User = url.UserPassword(opts.AuthUsername, opts.AuthPassword)
+ remoteAddr = u.String()
+ }
+
r, err := models.MigrateRepository(g.doer, owner, models.MigrateRepoOptions{
Name: g.repoName,
Description: repo.Description,
OriginalURL: repo.OriginalURL,
IsMirror: repo.IsMirror,
- RemoteAddr: repo.CloneURL,
+ RemoteAddr: remoteAddr,
IsPrivate: repo.IsPrivate,
Wiki: opts.Wiki,
SyncReleasesWithTags: !opts.Releases, // if didn't get releases, then sync them from tags