Thursday, March 19, 2015

Gitolite recover from lost authorized_keys

Sometimes bad things happed and you have to recover your git server from backup or you have corrupted authorized_keys for git user.

First of all, you should know what paths and user you using. For this example we have:

User: git

Home: /home/git

Repositories: /data/git (linked into /home/git as repositories)



First switch from root to gitolite user (git in our example), we will do everything under git user

su - git



So our situation is we haven't any .ssh/authorized_keys because something..
ls -l ~/.ssh/authorized_keys
ls: cannot access ~/.ssh/authorized_keys: No such file or directory



Look if gitolite has your keys in it's config directory.

ls -lR ~/.gitolite/keydir/

 

If you see your keys, perfect, just run

gitolite setup

If you don't, you have to recover that from your bare repository.
cd ~/
git clone /data/git/gitolite-admin.git ./temp
cd ./temp/
cp -rfp keydir ../.gitolite/
cp conf/gitolite.conf ../.gitolite/conf/
gitolite compile
gitolite setup

 

That's all, I hope it helps.

No comments:

Post a Comment

ESP8266 + InfluxDB + OLED DIsplay and DHT22

Basicly just put together from Examples. Sending data tu InfluxDB was little bit tricky using HTTPClient and POST method for InfluxDB.