Git/Theory

Server

병홍 2013. 5. 6. 11:22

Server

 

Protocol

Local, SSH, Git, HTTP(선택) 사용 가능.

 

Local

단순히 다른 디렉토리에 원격 저장소가 있어서 파일시스템을 팀원이 공유하고 있을 때 사용

git clone /opt/git/progect. git  또는 git clone file:///opt/git/project.git

git remote add local_git  /opt/git/progect.git

SSH

HTTP와 Git Protocol은 단순히 읽기만 가능하지만 SSH는 쓰기도 가능

git clone ssh://user@server:project.git 또는 git clone user@server:progject.git

 

Install

Bare 저장소(Working Directory가 없는 저장소) 만들기

git clone --bare my_project my_project.git

git clone은 git init과 git fetch를 함

서버에 저장소 설치

서버 이름 : git.example.com

scp -r my_project.git user@git.example.com:/opt/git

사용자가 ssh로 저장소로 접근하고 저장소를 Clone 할 수 있음

git clone user@git.example.com:/opt/git/my_project.git

사용자가 /opt/git/my_project.git에 권한이 있으면 Push 가능

ssh user@git.example.com

cd /opt/git/my_project.git

git init --bare --shared

--shared 옵션은 자동으로 그룹 쓰기 권한을 추가

Public Key

Git 서버들은 SSH Public Key로 인증

ssh-keygen

공개키(.pub) 만들기

Git Shell만 사용하기

vi /etc/passwd

git:x:1000:1000::/home/git:/bin/sh -> git:x:1000:1000::/home/git:/usr/bin/git-shell 변경