diff options
-rw-r--r-- | gitolite-sync.conf.in | 6 | ||||
-rw-r--r-- | gitolite-sync.in | 10 |
2 files changed, 13 insertions, 3 deletions
diff --git a/gitolite-sync.conf.in b/gitolite-sync.conf.in index 240ec0c..3ba06be 100644 --- a/gitolite-sync.conf.in +++ b/gitolite-sync.conf.in @@ -11,3 +11,9 @@ repository_dirs=( | sed 's,$,/repositories,' ) ) + +# name and path of default remote +default_remote_name='ecknernet' +default_remote_path_substitution=' + s#^'"${repository_dirs[0]}"'#gitolite@eckner.net:# +' diff --git a/gitolite-sync.in b/gitolite-sync.in index 067b87a..9c7bdf0 100644 --- a/gitolite-sync.in +++ b/gitolite-sync.in @@ -51,9 +51,13 @@ for repository_dir in "${repository_dirs[@]}"; do | sort -u ) if [ -z "${remotes}" ]; then - >&2 printf 'Repository "%s" has no backup remotes.\n' \ - "${path}" - continue + >&2 printf 'adding default remote "%s", because no remote was found so far\n' \ + "${default_remote_name}" + git -C "${path}" remote add "${default_remote_name}" "$( + printf '%s\n' "${path}" \ + | sed "${default_remote_path_substitution}" + )" + remotes="${default_remote_name}" fi for remote in ${remotes}; do git -C "${path}" fetch "${remote}" 'refs/heads/*:refs/heads/*' 'refs/tags/*:refs/tags/*' |