mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-27 21:03:56 +01:00
fix bug when migrating a private repository (#7917)
This commit is contained in:
parent
3ac45e3cb5
commit
ed58919bfc
1 changed files with 12 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue