gitolite

페이지 정보

작성자 박세원 댓글 0건 조회 9,171회 작성일 16-07-14 16:23

본문

[gitserver 구축]
1. git 설치
        root@git # apt-get install git

2. git-repo 계정 추가 - repository 계정...비유적으로 Mysql root계정
        root@git # adduser git-repo
        git-repo@host: git clone   

2. gittolite 설치
        git clone https://github.com/sitaramc/gitolite.git
        git-repo@git-server # ./gitolite/install

3. git-admin 계정 추가 - admin 계정...비유적으로 홈페이지 관리자계정
        root@git # adduser git-admin

4. git-admin 공개키 repository에 전송 및 관리자 부여           
        git-admin@git # ssh-keygen
        git-admin@git # scp .ssh/id_rsa.pub git-repo@git:/home/git-repo/git-admin.pub
        git-repo@git # ./gitolite/src/gitolite setup -pk git-admin 
<git clone 확인>   
        git-admin@git # git clone git-repo@localhost:gitolite-admin.git
gitolite-admin/conf : repository 권한설정
gitolite-admin/keydir : repository 계정 공개키 관리

[새로운 계정 repository에 추가]
        newuser가 공개키를 admin에게 전송
        git-admin@git # mv newuser.pub gitolite-admin/keydir/
        git-admin@git # git add newuser.pub
        git-admin@git # git commit -a -m "add newuser.pub"
        git-admin@git # git push
<git clone 확인>
        newuser@localhost # git clone git-repo@git:testing.git

[Push했을 때 E-mail 전송]
1. sendmail 설치
        root@git # apt-get install sendmail

2. hooks 설정
        git-repo@git # cd /path/to/your/repository.git
        git-repo@git # ln -sf /usr/share/git-core/contrib/hooks/post-receive-email hooks/post-receive
<debial기준 post-receive-email 경로: /usr/share/git-core/contrib/hooks/post-receive-email >

3. repository.git의 config 수정

        git-repo@git # vi /path/to/your/repository.git/config

...
[hooks]
        mailinglist = "받는이1" "받는이2" ...
        emailprefix = "[Git]" # email 제목 접두사
        envelopesender = "보내는이"
...

<hooks 설정 설명>
# Config
# ------
# hooks.mailinglist
#  This is the list that all pushes will go to; leave it blank to not send
#  emails for every ref update.
# hooks.announcelist
#  This is the list that all pushes of annotated tags will go to.  Leave it
#  blank to default to the mailinglist field.  The announce emails lists
#  the short log summary of the changes since the last annotated tag.
# hooks.envelopesender
#  If set then the -f option is passed to sendmail to allow the envelope
#  sender address to be set
# hooks.emailprefix
#  All emails have their subjects prefixed with this prefix, or "[SCM]"
#  if emailprefix is unset, to aid filtering
# hooks.showrev
#  The shell command used to format each revision in the email, with
#  "%s" replaced with the commit id.  Defaults to "git rev-list -1
#  --pretty %s", displaying the commit id, author, date and log
#  message.  To list full patches separated by a blank line, you
#  could set this to "git show -C %s; echo".
#  To list a gitweb/cgit URL *and* a full patch for each change set, use this:
#    "t=%s; printf 'http://.../?id=%%s' \$t; echo;echo; git show -C \$t; echo"
#  Be careful if "..." contains things that will be expanded by shell "eval"
#  or printf.
# hooks.emailmaxlines
#  The maximum number of lines that should be included in the generated
#  email body. If not specified, there is no limit.
#  Lines beyond the limit are suppressed and counted, and a final
#  line is added indicating the number of suppressed lines.
# hooks.diffopts
#  Alternate options for the git diff-tree invocation that shows changes.
#  Default is "--stat --summary --find-copies-harder". Add -p to those
#  options to include a unified diff of changes in addition to the usual
#  summary output.

http://sysadmin.compxtreme.ro/setup-gitolite-v3-and-email-notifications/





multimailhook -> 이게 더 나음

https://github.com/git/git/blob/4b1fd356b8f8ca464203174a47ab5fa6a5cbc26b/contrib/hooks/multimail/doc/gitolite.rst

git_multimail.py 설치
복사하고 post-receive 설정 (위 사이트 doc에 있음)

repo @all
    # Not strictly needed as git_multimail.py will chose gitolite if
    # $GL_USER is set.
    config multimailhook.environment = gitolite
    config multimailhook.from = cslab@jbnu.ac.kr
    config multimailhook.envelopesender = cslab@jbnu.ac.kr

envelopsender를 꼭 설정 -> 안그러면 메일 서버가 거부함

댓글목록

등록된 댓글이 없습니다.