centos7 환경에서 설치
git.admin
git.repo
두개 계정 생성
#useradd git.admin
#useradd git.repo
#passwd git.admin
#passwd git.repo
Git install (최신버전 설치)
# yum install http://opensource.wandisco.com/centos/7/git/x86_64/wandisco-git-release-7-2.noarch.rpm
# yum install git
repo 접속하기 위해서 admin 계정으로 key 생성
su - git.admin
$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/git.admin/.ssh/id_rsa):
Created directory '/home/git.admin/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/git.admin/.ssh/id_rsa.
Your public key has been saved in /home/git.admin/.ssh/id_rsa.pub.
The key fingerprint is:
e2:cc:d7:66:03:86:5f:ae git.admin
The key's randomart image is:
+--[ RSA 2048]----+
| |
| |
| * |
| o O |
| S = * . |
| . B = * |
| + = + * |
| . . . + . |
| . E |
+-----------------+
repo 계정으로 key 복사
$ cd /home/git.admin/.ssh/
$ scp id_rsa.pub git.repo@localhost:/home/git.repo/git.admin.pub
The authenticity of host 'localhost (::1)' can't be established.
ECDSA key fingerprint is ca:d7:ac:88:78:bb:69:a6:59:e3
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts.
git.repo@localhost's password:
id_rsa.pub 100% 434 0.4KB/s 00:00
Gitolite install
# su - git.repo
$ git clone https://github.com/sitaramc/gitolite.git
Cloning into 'gitolite'...
remote: Enumerating objects: 16, done.
remote: Counting objects: 100% (16/16), done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 9641 (delta 3), reused 10 (delta 2), pack-reused 9625
Receiving objects: 100% (9641/9641), 3.02 MiB | 2.21 MiB/s, done.
Resolving deltas: 100% (5974/5974), done.
$ ./gitolite/install
use the following full path for gitolite:
/home/git.repo/gitolite/src/gitolite
admin 에서 보낸 pub 키로 마무리 설정
$ ./gitolite/src/gitolite setup -pk git.admin.pub
Initialized empty Git repository in /home/git.repo/repositories/gitolite-admin.git/
Initialized empty Git repository in /home/git.repo/repositories/testing.git/
WARNING: /home/git.repo/.ssh/authorized_keys missing; creating a new one
(this is normal on a brand new install)
적용된거 확인
# su - git.admin
$ git clone git.repo@localhost:gitolite-admin.git
Cloning into 'gitolite-admin'...
remote: Enumerating objects: 6, done.
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 6 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (6/6), done.
적용하면 gitolite-admin 폴더 아래 conf / keydir 가 생성 된다.
conf 는 프로젝트별 권한 설정
keydir 는 개인 공개키 등록되는 곳 이다.
사용자 계정 추가
새로 추가할 환경의 장비에서 ssh-keygen 생성(위와 방법은 동일하다)
$ ssh-keygen
$ cd /home/test1/.ssh/
$ scp id.rsa.pub git.admin@52.2.12.198:/home/git.admin/gitolite-admin/keydir/test1.pub
pub 파일은 각 계정에 맞게 이름 바꿔서 복사 해주면 된다.
# su - git.admin
$ cd /home/git_admin/gitolite-admin
$ git add keydir/test1.pub
git commit -a -m "add user test1"
[master 6f6d9f5] add user dino_windows
1 file changed, 1 insertion(+)
create mode 100644 keydir/test1.pub
$ git push
Enumerating objects: 6, done.
Counting objects: 100% (6/6), done.
Delta compression using up to 8 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 728 bytes | 728.00 KiB/s, done.
Total 4 (delta 0), reused 0 (delta 0)
To localhost:gitolite-admin.git
0c30648..6f6d9f5 master -> master
위와 같이 계정을 등록시켜주면 된다.
프로젝트 추가
$ vi /home/git.admin/gitolite-admin/conf/gitolite.conf
repo gitolite-admin
RW+ = admin
repo testing
RW+ = @all
repo new_project
RW+ = @all
위와 같이 추가 및 설정 하고 저장
$ git commit -a -m "add project 'new_project'"
[master abaa8e1] add project 'new_project'
1 file changed, 3 insertions(+)
$ git push
Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 375 bytes | 375.00 KiB/s, done.
Total 4 (delta 1), reused 0 (delta 0)
remote: Initialized empty Git repository in /home/git.repo/repositories/new_project/
To localhost:gitolite-admin.git
32f5ccb..abaa8e1 master -> master
위와 같이 진행 하면 됨
'Linux' 카테고리의 다른 글
apache 로그 예외 처리 (0) | 2019.08.02 |
---|---|
roundcube install for centos (0) | 2019.07.18 |
Transaction check error: file /boot/efi/EFI/centos from install of fwupdate-efi-12-5.el7.centos.x86_64 conflicts with file from package grub2-common-1:2.02-0.64.el7.centos.noarch (0) | 2019.05.14 |
ubuntu 18.04 xrdp install (0) | 2019.05.02 |
jetbrains Upsource install (0) | 2019.05.02 |