Changes between Version 3 and Version 4 of Give users access to gitolite repos
- Timestamp:
- 04/29/25 21:17:12 (4 weeks ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Give users access to gitolite repos
v3 v4 1 1. 🗝️ Create a new SSH key pair 1 == Create a new SSH key pair for every user or role 2 2 3 {{{#!sh 3 4 ssh-keygen -t ed25519 -f ~/.ssh/KEYNAME 5 }}} 6 4 7 Example: 5 8 9 {{{#!sh 6 10 ssh-keygen -t ed25519 -f ~/.ssh/mesechannel 7 ✅ Creates: 11 }}} 12 13 This creates: 8 14 9 15 ~/.ssh/mesechannel (private key) 10 16 ~/.ssh/mesechannel.pub (public key) 11 2. 🗝️ Add the new public key to Gitolite12 17 13 Clone the gitolite-admin repo if you haven't already:14 18 19 == Add the new public key to Gitolite 20 21 === Clone the gitolite-admin repo if you haven't already: 22 23 {{{#!sh 15 24 git clone kokyou.dev:gitolite-admin 16 (use your admin key). 25 }}} 17 26 18 Then: 27 === Copy the user key to the keydir 19 28 29 {{{#!sh 20 30 cd gitolite-admin 21 31 cp ~/.ssh/mesechannel.pub keydir/mesechannel.pub 22 ✅ You added the user key. 32 }}} 23 33 24 3. 🛠️ Edit conf/gitolite.conf 25 26 Edit conf/gitolite.conf: 27 28 @devs = mesechannel mesepackager 29 34 == Edit conf/gitolite.conf 35 {{{ 30 36 repo airsituation 31 RW+ = @devs 37 RW+ = admin mesechannel 38 R = mesepackager 32 39 33 40 repo gitolite-admin 34 RW+ = admin mesechannel35 ✅ Both admin and mesechannel can now fully control Gitolite. 41 RW+ = admin 42 }}} 36 43 37 4. 📤 Admin Push Syntax (VERY IMPORTANT) 44 Only admin can write to the gitolite-admin repo 45 Both admin and mesechannel can fully control the airsituation repo. 46 mesepackager can only read the air situation repo 47 48 == Push changes to effect your setup 38 49 39 50 Once you changed keydir/ and/or conf/, you must commit and push like this: 40 51 52 {{{#!sh 41 53 git add keydir/ 42 54 git add conf/gitolite.conf 43 git commit -m "Add mesechannel as dev and admin"44 55 git push 45 In short: 56 }}} 46 57 47 Always git add the modified files. 48 Always git commit. 49 Always git push to update Gitolite immediately. 50 ✅ After push, Gitolite applies changes automatically — no restart needed. 58 After push, Gitolite applies changes automatically — no restart needed. 51 59 52 5. 🔐Edit local ~/.ssh/config60 == Edit local ~/.ssh/config 53 61 54 62 Host kokyou.dev … … 68 76 IdentityFile ~/.ssh/mesepackager 69 77 IdentitiesOnly yes 70 ✅ SSH knows which key to use depending on which Host alias you reference.71 78 72 6. 🚀 Push an existing local project to Gitolite 79 SSH knows which key to use depending on which Host alias you reference. 80 81 == Push an existing local project to Gitolite 73 82 74 83 From your project directory: 75 84 85 {{{#!sh 76 86 cd ~/projects/myproject 77 87 git remote add origin gitolite-mesechannel:airsituation 78 git push -u origin main79 ✅ Your full project history is uploaded. 88 git push 89 }}} 80 90 81 7. 📥 Clone a repo using different users/keys 91 In case you want to push as admin use 92 93 {{{#!sh 94 git remote add origin kokyou.dev:airsituation 95 }}} 96 97 == Clone a repo using different users/keys 82 98 83 99 Example: 84 100 101 {{{#!sh 85 102 git clone gitolite-mesechannel:airsituation 103 }}} 104 86 105 or 87 106 107 {{{#!sh 88 108 git clone gitolite-mesepackager:some-other-repo 109 }}} 110 89 111 depending on which SSH identity you use. 112 90 113 [wiki:Workflows back]