본문 바로가기
Projects/Ubuntu Git Server

[Ubuntu Git Server] 3. Repository 생성 및 사용자 등록

by DevJaewoo 2021. 12. 2.
반응형

Git LOGO

 

Repository 생성

새 repo를 생성하기 위해 git-admin 계정으로 로그인한다.

$ ssh git-admin@remote_host
$ cd gitolite-admin

 

repo를 관리하는 설정 파일을 열어준다.

nano conf/gitolite.conf

 

특별히 수정한게 없다면 아래와 같은 내용이 적혀있을 것이다.

repo gitolite-admin
    RW+     =   git-admin

repo testing
    RW+     =   @all

 

새 repo를 추가하기 위해 파일 아래에 다음과 같은 내용을 추가한다.

repo_nameusername은 적당히 수정하여 사용하면 된다.

 

repo를 생성하기 위해 적어도 하나의 사용자에게 권한을 부여해야 한다.

repo repo_name
    RW+	    =   username

 

파일을 저장했다면 gitolite repo에 수정사항을 반영한다.

$ git add conf/gitolite.conf
$ git commit -m 'Add new repo repo_name' 
$ git push origin master

 

push가 완료되면 아래와 같이 새로운 repo를 추가했다는 메시지를 볼 수 있다.

remote: Initialized empty Git repository in /home/git/repositories/repo_name.git/
To localhost:gitolite-admin.git
   2afea3f..0435017  master -> master
# ls -laF /home/git/repositories/
total 0
drwx------ 5 git git  67 Dec  2 05:20 ./
drwxr-xr-x 7 git 118 168 Dec  2 05:20 ../
drwx------ 8 git git 181 Dec  2 05:20 gitolite-admin.git/
drwx------ 7 git git 134 Dec  2 05:20 repo_name.git/
drwx------ 7 git git 162 Dec  2 05:20 testing.git/

 

이후 클라이언트에서 아래의 URL로 접근할 수 있다.

ssh://git@remote_addr:repo_name.git

 

만약 "no path specified; see 'git help pull' for valid url syntax" 라는 경고문구가 나오면 앞의 ssh://를 제외한 URL을 입력하고 다시 접근하면 된다.

git@remote_addr:repo_name.git

 

반응형

'Projects > Ubuntu Git Server' 카테고리의 다른 글

[Ubuntu Git Server] 2. 사용자 추가  (0) 2021.12.02
[Ubuntu Git Server] 1. 서버 환경 구축  (0) 2021.12.01