Search code examples
gitubuntugitolitemirror

Unable to read from remote repository after git mirror


I have been experimenting with creating a mirror of one of my gitolite repositories and have run into a problem. I created the mirror on the same machine as the original git repositories using the commands;

cd /var/repo_mirrors
git clone --mirror /home/gitolite/repositories/Test.git

( I was essentially following the steps from here: http://www.redmine.org/projects/redmine/wiki/RedmineRepositories#Git-repository )

I also wanted to be able to browse the repository so i did a chown to www-data so that Apache could read.

That all worked fine. But the problem now is i'm unable to clone/push the original repository. When i try i get the following error;

fatal: failed to read object a0d91d1cc22bfbd5666d51c1ea7a5015008e50b6: Permission denied fatal: Could not read from remote repository.

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

Note: before the mirror everything worked OK

Any ideas on what went wrong would be appreciated.


Solution

  • This might be related to the hardlinks created during a git clone:

    The files under .git/objects/ directory are hardlinked to save space when possible.

    Try the same clone, but without hardlinks:

    cd /var/repo_mirrors
    git clone --mirror --no-hardlinks /home/gitolite/repositories/Test.git