Version 5 (modified by 4 weeks ago) ( diff ) | ,
---|
Create a new SSH key pair for every user or role
ssh-keygen -t ed25519 -f ~/.ssh/KEYNAME
Example:
ssh-keygen -t ed25519 -f ~/.ssh/mesechannel
This creates:
~/.ssh/mesechannel (private key)
~/.ssh/mesechannel.pub (public key)
Add the new public key to Gitolite
Clone the gitolite-admin repo if you haven't already:
git clone kokyou.dev:gitolite-admin
Copy the user key to the keydir
cd gitolite-admin cp ~/.ssh/mesechannel.pub keydir/mesechannel.pub
Edit conf/gitolite.conf
repo airsituation RW+ = admin mesechannel R = mesepackager repo gitolite-admin RW+ = admin
Only admin can write to the gitolite-admin repo
Both admin and mesechannel can fully control the airsituation repo.
mesepackager can only read the airsituation repo
Push changes to effect your setup
Once you changed keydir/ and/or conf/, you must commit and push like this:
git add keydir/ git add conf/gitolite.conf git push
After push, Gitolite applies changes automatically — no restart needed.
Edit local ~/.ssh/config
Host kokyou.dev
User git IdentityFile ~/.ssh/admin IdentitiesOnly yes
Host gitolite-mesechannel
HostName kokyou.dev User git IdentityFile ~/.ssh/mesechannel IdentitiesOnly yes
Host gitolite-mesepackager
HostName kokyou.dev User git IdentityFile ~/.ssh/mesepackager IdentitiesOnly yes
SSH knows which key to use depending on which Host alias you reference.
Push an existing local project to Gitolite
From your project directory:
cd ~/projects/myproject git remote add origin gitolite-mesechannel:airsituation git push
In case you want to push as admin use
git remote add origin kokyou.dev:airsituation
Clone a repo using different users/keys
Example:
git clone gitolite-mesechannel:airsituation
or
git clone gitolite-mesepackager:some-other-repo
depending on which SSH identity you use.