samrocketman / gitlab-mirrors

A set of scripts adding the ability of managing remote mirrors to GitLab.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Recovering from failure during mirror creation

dankegel opened this issue · comments

There's a bit of a rough edge if you forget to type in the git password the second time soon enough:

$ ./add_mirror.sh --git --project-name sheeple --mirror git.blarg.com:/git/repo/sheeple
Resolving gitlab remote.
Creating mirror from git.blarg.com:/git/repo/sheeple
Cloning into bare repository 'sheeple'...
xxx@git.blarg.com's password:
remote: Counting objects: 189006, done.
remote: Compressing objects: 100% (44683/44683), done.
remote: Total 189006 (delta 143540), reused 187790 (delta 142452)
Receiving objects: 100% (189006/189006), 233.55 MiB | 15.07 MiB/s, done.
Resolving deltas: 100% (143540/143540), done.
Checking connectivity... done.
Adding gitlab remote to project.
Checking the mirror into gitlab.
xxx@git.blarg.com's password:
Connection closed by 10.10.10.90
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
$ ./add_mirror.sh --git --project-name sheeple --mirror git.blarg.com:/git/repo/sheeple
Error: "/home/gitmirror/repositories/mirrors/sheeple" exists already. Aborting command.

Letting the cron job run doesn't seem to complete the mirror.

Removing that directory and rerunning the script seems to work around it.

It is working as intended. It's a simple bash script that checks if the cloned repository exists by its directory existing. Consider using alternate forms of auth such as SSH with ssh-agent or making use of git credential helpers.