Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recreating Gitolite-admin Repo

I have taken over a project where the previous admin provided no help, no documentation and no handover...I am trying to clone the gitolite-admin repo so that I can add myself as a user.

The issue is that when I run

git clone gitolite@repo1:gitolite-admin.git

I receive the error

R access for gitolite-admin DENIED to macbook
(Or there may be no repository at the given path. Did you spell it correctly?)
fatal: The remote end hung up unexpectedly

With the server's conf/gitolit.conf file containing

repo    gitolite-admin
    RW+     =   macbook

My repositories contains gitolite-admin.git amongst others, and I successfully ran

git clone gitolite@repo1:wp_of_travel

When I run

ssh gitolite@repo1 info

I am returned a number of projects, but gitolite-admin is not listed there.

Is my situation hopeless or am I missing something where I can reconstruct the repo and clone it again?

I do have full control over the server if that helps...

Any help or advice on this matter is more than welcome. Thank you

like image 252
edev.io Avatar asked Oct 05 '22 19:10

edev.io


1 Answers

When I run

ssh gitolite@repo1 info

I am returned a number of projects, but gitolite-admin is not listed there.

This is normal: if macbook isn't registered in that project in the gitolite.conf of the repo (not your own local gitolite.conf, but the one currently stored in the gitolite-admin.git repo), you won't see it listed.

If you have access to the server, you can clone the gitolite-admin.git locally (file protocol, no ssh here), add your name (after your public ssh key), push back, and run gitolite setup (if you are using gitolite v3), in order for gitolite to update the ~/.ssh/authorized_keys files.


With a gitolite V2, the page gl-admin-push: bypassing gitolite for the gitolite-admin repo is helpful:

Clone the repo to some safe location and cd to it:

cd /tmp
git clone ~/repositories/gitolite-admin.git
cd gitolite-admin

Make whatever changes you want to that clone and commit. You can add new keys, change the conf file, or anything at all that needs fixing up. You can even reset to an older commit (rewind) if that is the simplest way to fix up some config problem that may have lost you your access.

When done, instead of git push <push arguments>, use this program instead.
For example, instead of git push -f, use gl-admin-push -f.

The OP edwardgd confirms in the comments:

Looks like the previous sysadmin had done a failed installation to root as well as to the user gitolite, that was why I was getting sooo confused.
For reference the adminpush method is very simple once you know where to apply it.

like image 121
VonC Avatar answered Oct 10 '22 03:10

VonC