1

I have been running gitolite for some time and this week set up a second server as a mirror for all of my repositories.

I have the following stanzas in the gitolite.conf file that has been pushed to both servers:

repo data/[0-9]+/..*
    C       =   @developers
    RW+     =   @developers
    R       =   @all
    option mirror.master  = oxygen
    option mirror.slaves  = nitrogen

repo mirror_test
    RW+     =   @all
    option mirror.master  = oxygen
    option mirror.slaves  = nitrogen

I have repos of the names "data/11756/machine11756.git", "data/11756/recorded11756.git", and "data/11779/machine11779.git", over 70 in total.

After setting up mirroring and testing it via the mirror_test repo. I needed to get copies of the repos onto the slave, so I then wrote a script to run "ssh gitolite mirror push nitrogen ". Only nine of these mirror pushes succeeded, the remaining ones returned:

fatal: '/home/git/repositories/data/11756/machine11756.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

What is going on?

jimzat
  • 45
  • 5
  • In order to move forward, I decided to manually copy the repos from master to slave. Once I did this, I re-ran my script (to verify things) and all appeared to be fine. All that being said, I am beyond the immediate problem, but would like anyone's input as to what may have gone wrong so that I don't run across it in the future if I set up any additional slaves. – jimzat Sep 24 '19 at 21:06

1 Answers1

0

The syntax for Gitolite mirroring should be:

ssh git@host mirror push slave-server-name repo-name

In your case, gitolite can be an entry in ~/.ssh/config.

Beside a possible SSH syntax issue, it would come done to an access or permission issue on the remote side.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I have a alias in my ~/.ssh/config file defining the Host "gitolite" as hostname "oxygen". If this were NOT the case then NONE of the pushes would have worked. The question is, "why do SOME of them fail?" – jimzat Sep 25 '19 at 12:35
  • @jimzat I agree, this is not a syntax, issue, hence the "access or permission" bit I mention in the answer. What does a gitolite tracing returns? (https://gitolite.com/gitolite/conf-2.html#tracing-the-access-control-decision) – VonC Sep 26 '19 at 06:17
  • How can I use "gitolite access" to check on mirror pushes? Where should I run this master or slave? What username do I use, "git"? – jimzat Sep 27 '19 at 14:43
  • @jimzat Yes (https://gitolite.com/gitolite/cookbook.html#access), from the slave where you have the error message. The username would be one supposed to be authorized by Gitolite to access the remote repo (and added to Gitolite: https://gitolite.com/gitolite/basic-admin#addremove-users) "git" is only the account used to install Gitolite. – VonC Sep 27 '19 at 15:15
  • Running "ssh info" on my local machine reports back that I am user "JiMZ_laptop" (the same user shows up when I run and "info" on the git_master). If I then run "gitolite access -s data/11755/machine11755 JiMZ_laptop W any" while loggedinto the git user on the git_slave, I get " p gitolite.conf:24 C = @developers/ A gitolite.conf:25 RW+ = @developers" – jimzat Sep 27 '19 at 22:31
  • @jimzat Is gitolite installed with a dedicated "git" account? – VonC Sep 28 '19 at 04:44
  • yes on both the master and slave gitolite servers, I installed gitolite to be run under the dedicated user named "git" – jimzat Sep 30 '19 at 15:46
  • @jimzat "`ssh info` on my local machine reports back that I am user `JiMZ_laptop`": it should report `git`, for gitolite to be involved. – VonC Sep 30 '19 at 18:33
  • My local machine does not have write privileges to the slave, therefore JiMZ_laptop cannot push there, I am pushing from the master to slave. If I run "ssh nitrogen info" from oxygen, I receive "hello server-oxygen, this is git@Nitrogen". – jimzat Oct 01 '19 at 12:50
  • @jimzat so... it reports git, now? – VonC Oct 01 '19 at 12:53
  • The server has always reported itself as git@[oxygen|nitrogen] – jimzat Oct 01 '19 at 13:10
  • @jimzat OK, I was confused by your comment "`ssh info` on my local machine reports back that I am user `JiMZ_laptop`": user `JiMZ_laptop`, not "`git`" – VonC Oct 01 '19 at 13:16
  • To create a new repo on the server(s) from my local machine, I do "git init", "git add .", "git commit", "git remote add origin gitolite:data/999/junk9999.git", "git push origin HEAD" -- all goes well getting the new repo onto BOTH the master and slave. If I attempt to push an existing repo from master to slave via "ssh gitolite mirror push nitrogen data/11755/machine11755", the slave returns a fatal error to the master. – jimzat Oct 01 '19 at 13:21
  • @jimzat Looks good. Does `/home/git/repositories/data/999/junk9999.git` exists after that push on the remote side? – VonC Oct 01 '19 at 13:26
  • Yes junk9999 DOES exist, the problem is (and is the point of the OP), that I cannot run "mirror push" on all of the master repos to get them onto the slave – jimzat Oct 01 '19 at 13:37
  • @jimzat OK, strange. According to your `gitolite access`, if you are part of the developer group, you should have the ability to create, access and change a repository there. – VonC Oct 01 '19 at 13:40
  • @jimzat Just in case this is relevant: https://groups.google.com/forum/#!topic/gitolite/tmmp4Q5pJLI, and https://gitolite.com/gitolite/mirroring.html#appendix-d-fixing-a-broken-slave – VonC Oct 01 '19 at 13:42