CentOS 8
Sponsored Link

Git : Gitolite : Set Access Control2020/04/16

 
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 dd760cb] 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 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 370 bytes | 185.00 KiB/s, done.
Total 4 (delta 1), reused 0 (delta 0)
To ssh://GitServer/gitolite-admin
   5c805f7..dd760cb  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 8b67ee4] 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 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 438 bytes | 219.00 KiB/s, done.
Total 4 (delta 0), reused 0 (delta 0)
remote: Initialized empty Git repository in /var/lib/gitolite3/repositories/project02.git/
To ssh://GitServer/gitolite-admin
   dd760cb..8b67ee4  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 70da8b7] Change Permission for project03
 1 file changed, 8 insertions(+)
[gitolite3@dlp conf]$
git push

Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 494 bytes | 494.00 KiB/s, done.
Total 4 (delta 0), reused 0 (delta 0)
remote: WARNING: syntax error, ignoring: 'R+ = id_redhat'
remote: Initialized empty Git repository in /var/lib/gitolite3/repositories/project03.git/
To ssh://GitServer/gitolite-admin
   39e981a..70da8b7  master -> master
Matched Content