1
1
mirror of https://github.com/cooperspencer/gickup synced 2024-09-08 03:50:36 +02:00

configure a user to clone to. for structured cloning (#219)

This commit is contained in:
Andreas Wachter 2024-04-03 08:24:23 +02:00 committed by GitHub
parent 95336a896d
commit bf58b23155
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View File

@ -192,6 +192,7 @@ source:
lastactivity: 1y # only clone repos which had activity during the last year
any:
- url: url-to-any-repo # can be https, http or ssh
user: your-preferred-user # the user to want to associate with this repo, default: git
username: your-user # user is used to clone the repo with
password: your-password
ssh: true # can be true or false
@ -289,4 +290,4 @@ metrics:
# like "mirror all repos from github to gitea but keep gitlab repos up-to-date in ~/backup"
# if cron is defined in the first config, this cron interval will be used for all the other confgurations, except it has one of its own.
# if cron is not enabled for the first config, cron will not run for any other configuration
# metrics configuration is always used from the first configuration
# metrics configuration is always used from the first configuration

View File

@ -32,6 +32,13 @@ func Get(conf *types.Conf) ([]types.Repo, bool) {
var auth transport.AuthMethod
hoster := "local"
if repo.User == "" {
if repo.Username != "" {
repo.User = repo.Username
} else {
repo.User = "git"
}
}
if _, err := os.Stat(repo.URL); os.IsNotExist(err) {
hoster = types.GetHost(repo.URL)
if strings.HasPrefix(repo.URL, "http://") || strings.HasPrefix(repo.URL, "https://") {
@ -97,7 +104,7 @@ func Get(conf *types.Conf) ([]types.Repo, bool) {
Token: repo.GetToken(),
Defaultbranch: main,
Origin: repo,
Owner: "git",
Owner: repo.User,
Hoster: hoster,
})
}