CentOS Stream 8
Sponsored Link

Git : Gitolite : Set Access Control2021/06/18

 
Set Access Control for Repositories. Work with Gitolite admin user.
[1] For example, Set Access Control to [project01] repository that [cent] user can read/write. (include authority of falling back revisions)
[gitolite3@dlp ~]$
cd ~/gitolite-admin/conf

[gitolite3@dlp conf]$
vi gitolite.conf
# add to the end

# for username, specify user's SSH key name

# to add [+], it includes authority of falling back revisions

repo project01
    RW+     =   id_cent

[gitolite3@dlp conf]$
git commit -a -m "Change Permission for project01"

[master cd9c8ad] Change Permission for project01
 1 file changed, 1 insertion(+), 1 deletion(-)

[gitolite3@dlp conf]$
git push

Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 2 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 374 bytes | 374.00 KiB/s, done.
Total 4 (delta 1), reused 0 (delta 0), pack-reused 0
To ssh://GitServer/gitolite-admin
   bd3bff0..cd9c8ad  master -> master
[2] For example, Set Access Control to [project02] repository that [developer] group can read/write.
[gitolite3@dlp ~]$
cd ~/gitolite-admin/conf

[gitolite3@dlp conf]$
vi gitolite.conf
# add to the end

@developer = id_cent id_redhat

repo project02
    RW      =   @developer

[gitolite3@dlp conf]$
git commit -a -m "Change Permission for project02"

[master 929736f] Change Permission for project02
 1 file changed, 5 insertions(+)

[gitolite3@dlp conf]$
git push

Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 2 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 442 bytes | 442.00 KiB/s, done.
Total 4 (delta 0), reused 0 (delta 0), pack-reused 0
remote: Initialized empty Git repository in /var/lib/gitolite3/repositories/project02.git/
To ssh://GitServer/gitolite-admin
   cd9c8ad..929736f  master -> master
[3] For example, Set Access Control to [project03] repository like follows.
* all users can read to all branches
* [id_redhat] user can read/write to all branches
* [developer2] group can read/write to [develop] branch
* [deployer] group can read/write to [release] branch
[gitolite3@dlp ~]$
cd ~/gitolite-admin/conf

[gitolite3@dlp conf]$
vi gitolite.conf
# add to the end

@developer2 = id_cent id_fedora
@deployer = id_debian id_ubuntu

repo project03
    R           =  @all
    RW          =  id_redhat
    RW develop  =  @developer2
    RW release  =  @deployer

[gitolite3@dlp conf]$
git commit -a -m "Change Permission for project03"

[master ed6fe56] Change Permission for project03
 1 file changed, 9 insertions(+)

[gitolite3@dlp conf]$
git push

Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 2 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 502 bytes | 251.00 KiB/s, done.
Total 4 (delta 0), reused 0 (delta 0), pack-reused 0
remote: Initialized empty Git repository in /var/lib/gitolite3/repositories/project03.git/
To ssh://GitServer/gitolite-admin
   929736f..ed6fe56  master -> master
Matched Content