일상의 정리

'SVN'에 해당되는 글 3건

  1. SVN 무시할 파일/폴더 설정
  2. Linux 상에서 svn 사용하기
  3. svn+ssh 암호 없이 사용하기

SVN 무시할 파일/폴더 설정

리눅스/설치

Ignore file

To ignore all files with the ending .o use:

Ignore dir

If you want to ignore folder tmp

Ignore multiple files/dirs

If you want to ignore tmp,obj,bin dirs and all files with *.o
*.lib,*.la
extension. Save this file

and name it svnignore.txt, the following command will do the job !

Ignore multiple files/dirs via command line

This will bring up list of files or directories to ignore.

Find files that are not under version control

To find such files:


Linux 상에서 svn 사용하기

리눅스/설치
대개의 프로젝트는 윈도에서 하므로 TortoiseSVN을 사용하지만...
일부 서버는 리눅스 상에서 개발하므로 리눅스에서도 사용해야 되는 경우가....

다음은 리눅스에서 svn 기본 명령 사용법 정리이다.

1. 저장소 만들기
일단 root로 로그인
# cd /home/svn
--> 저장소를 생성
# svnadmin create --fs-type fsfs <repository명>
--> svn group이 저장소에 Access 가능하도록 directory 속성변경
# chmod -R o-x <repository명>
# chmod -R o-r <repository명>
# chmod -R g+w <repository명>
# chgrp -R svn <repository명>

2. 자신의 계정에서 생성한 저장소 Access
--> 자신의 사용자로 로그인
--> ~/.bash_profile 에 다음 줄 추가하여 환경변수 생성
export SVN_EDITOR=vi
--> 원하는 폴더로 감
$ cd ~/gits
--> 요렇게 하면 현재 디렉토리 아래에 <directory명>에 해당되는 directory가 생성되고 그 아래 소스트리를 만들면 된다.
$ svn checkout svn+ssh://localhost/home/svn/<repository명> <directory명>
--> <directory명> 으로 가서 작업
--> 로컬 디렉토리 또는 파일 저장소에 추가하기
$ svn add <파일명>
--> 로컬 디렉토리 또는 파일 커밋하기
$ svn commit
--> 저장소의 최근 내용으로 로컬 파일 업데이트 하기
$ svn update

더 자세한 내용은 아래 페이지 참조

http://www.pyrasis.com/main/Subversion-HOWTO

svn+ssh 암호 없이 사용하기

리눅스/설치

1. Cent OS 에 svn 설치하기

 

# yum install subversion

 

# mkdir /home/svn

 

2. 저장소 위치 설정

# groupadd svn

/etc/group 에 svn 그룹에 포함될 사용자(svn을 사용할 사용자)를 추가한다.

 

3. 저장소 추가

# cd /home/svn

# svnadmin create --fs-type fsfs sample

--> group 쓰기가 가능하도록 설정한다

# chgrp -R svn sample

# chmod -R g+w sample

 

ssh 로 사용할 경우에는 패스워드 파일 생성등 별도의 작업이 필요 없다.

 

4. TortoiseSVN 에서 암호 없이 접속하기

접속할 계정으로 터미널 접속

$ ssh-keygen -b 1024 -t rsa

Generating public/private rsa key pair.
Enter file in which to save the key (/home/admin/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/admin/.ssh/id_dsa.
Your public key has been saved in /home/admin/.ssh/id_dsa.pub.

$ cd .ssh

$ mv id_rsa.pub authorized_keys

$ ssh localhost
The authenticity of host 'localhost (127.0.0.1)' can't be established.
RSA key fingerprint is 89:79:86:1b:cb:fc:a0:05:9c:65:88:b5:4c:1b:7f:c8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'localhost' (RSA) to the list of known hosts.
Last login: Sun Jan 11 00:43:26 2004 from 192.168.0.25

만약... 위의 방법으로 접속이 실패했다면...
sshd가 인증키로 인증을 허용하지 않기 때문이다.
이럴 경우.
sshd_config(보통은 /etc/ssh/sshd_config)에 다음 두줄이 포함되어 있는지 확인하자.

PubkeyAuthentication yes
AuthorizedKeysFile      .ssh/authorized_keys

만약 개인키를 암호 없이 사용하는 것이 찝찝하다면 ssh-keygen 을 실행시 암호를 주면 된다.
 

Winscp 나 psftp 를 이용해서 위에서 만든 개인키 (id_rsa) 를 가져온다.


puttygen을 실행 후 메뉴 중의 Convesions - Import Key 로 가져온 개인키를 로드

다른 건 건드리지 말고 


Save private key 로 개인키를 적당한 이름의 xxx.ppk 파일로 저장한다.


-------------------------------------------------------

1. pagent.exe 를 사용하는 방법 
-------------------------------------------------------
저장 후 pageant.exe 를 실행하며 트레이 아이콘에 표시되는 데 Add Key 로

위에서 저장한 xxx.ppk 파일을 로드한다.

 

이 상태에서 SVN 명령을 수행할 경우 암호 없이 사용가능하다.
-------------------------------------------------------

-------------------------------------------------------
2. TortoisePlink 를 이용하는 방법
-------------------------------------------------------
TortoiseSVN을 설치한 후 

c:\Documents and Settings\username\Application Data\Subversion\config

파일을 오픈한 후

[tunnels]
항목에 다음과 같이 추가한다.
ssh2222 = C:/Program Files/TortoiseSVN/bin/TortoisePlink.exe -P 2222 -i "d:/keys/mykey.ppk"

2222는 ssh 포트가 다를 경우 지정하는 것이고
-i 뒤에 키파일을 지정한다.

위와 같이 한 후 
svn+ssh2222://
처럼 포트를 바꾸고 패스워드를 묻지 않도록 사용할 수 있다.
---------------------------------------------------------