user25299556
user25299556

Reputation: 21

gitolite scenario - git push fails with error "FATAL: <host>: '<repo>' is local"

I am debugging an old legacy gitolite server instance issue where git push fails with "FATAL: <host>: '<repo>' is local" message and need help fixing this.

Following are gitolite instance details:

While logged in as "gituser" on server (master), after any git edits for any cloned gitolite repository, the command "git push" fails with following error:. Any other git admins know why following error may be showing up.

Note: The similar git push works for users from other systems. Tried to debug with git/ssh verbose logging, changing remote set-url and there is not much additional information and not sure why .gitolite log shows mode=local and mirror, while steps are on master. I have a need to try git clone, edits and git push from master.

Error seen:

$ git push
FATAL: gitmaster: 'gitolite-admin' is local
fatal: Could not read from remote repository.

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

~/.gitolite/logs/xxxxx entry:

.... ssh ARGV=server-gitmaster SOC=git-receive-pack 'gitolite-admin' FROM=<ip>
.... mirror,pre_git,gitolite-admin,user=,sender=gitmaster,mode=local

git remote -v shows:

origin  gituser@gitmaster:gitolite-admin (fetch)
origin  gituser@gitmaster:gitolite-admin (push)

gituser's .ssh/config:

...
host gitmaster
     user gituser
     hostname <gitmaster.domain.name>

gitolite.conf snippet:

repo gitolite-admin
    RW+     =   @admins
    option mirror.master    =  gitmaster
    option mirror.slaves    =  gitslave

Tried with git and ssh verbose logging, analyzed ssh and gitolite logs and there is not much useful info.

Upvotes: 2

Views: 103

Answers (1)

VonC
VonC

Reputation: 1324935

The Gitolite's mirroring feature is designed to keep a master repository in sync with slave repositories. In your case, gitmaster is the master, and gitslave is the slave.
The .ssh/config file on the master server defines aliases (gitmaster and gitslave) that are used to simplify SSH connections to these servers.
But: the combination of mirroring and SSH aliases seems to be causing Gitolite to interpret the gitmaster alias as a local repository instead of the remote server. It attempts to push changes locally, resulting in the "FATAL: <host>: '<repo>' is local" error. You can see that error defined and thrown in the Gitolite source code at Triggers/Mirroring.pm, and it should be caused by:

  • an incorrect SSH alias configuration, where Gitolite misinterprets the repository location.
  • an incorrect setting in the gitolite.conf

For testing, try and comment out or remove the gitmaster alias from .ssh/config: that should force the usage of the actual hostname, preventing Gitolite from treating the repository as local.
And/or try to specify the full remote URL explicitly: git push [email protected]:gitolite-admin

Regarding the gitolite.conf, as a temporary measure, disable mirroring to see if the push works.

Upvotes: 2

Related Questions