I want to add a ssh key to my gitolite server from a new workstation. I can't do it through gitosis-admin, because I can't clone it, and I don't have access to my previous laptop containning the ssh-key with which I installed gitolite.
How can I add my new key to gitosis-admin/keydir without cloning gitosis-admin?
Thanks
The "Don't panic" page can help (for gitolite V3, not the old obsolete gitosis):
If you lost your gitolite admin key or access, here's what you do. We'll assume your username is '
alice
'.
- Make yourself a new keypair and copy the public key to the server as '
alice.pub
'.- Log on to the server, and run
gitolite setup -pk alice.pub
.That's it; the new
alice.pub
file replaces whatever existed in the repo before.
That would allow you to add keys using a clone of gitolite-admin
repo, as you should.
That won't "reset" your gitolite.conf file, or anything in your gitolite-admin repo: it will complete the ~/.ssh/authorized_keys
file.
It certainly have no effect on your existing repositories.
That being said, if a gitolite command seems too risky, you can try the second approach:
You may have lost access because of a conf file error, in which case the above trick won't help. What you want is to make changes to the repo (or perhaps just rewind) and push that. Here's how to do that:
- Log on to the server.
- Clone the admin repo using the full path: git clone $HOME/repositories/gitolite-admin.git temp.
- Make whatever changes you want -- add/replace a key, 'git revert' or 'git reset --hard' to an older commit, etc. Anything you need to fix the problem, really.
- Run gitolite push (or possibly gitolite push -f). Note that's 'gitolite push', not 'git push'.
NOTE: gitolite does no access checking when you do this!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With