반응형

 

 



다른 보드들로 작업을 많이 하다보니 애물단지가 되버린 라즈베리파이를 git서버로 사용해보려고 기존 라즈베리 파이에 꽂혀있던 SD카드를 다시 설정 해봤습니다.

라즈베리파이 설정하기http://webnautes.tistory.com/640

 

그리고 라즈베리파이에 연결할 저장장치가 아직은 마땅한게 없어서 USB메모리를 임시로 연결해보기로 했습니다. 추후 외장 하드디스크가 생기면 교체를 할듯합니다.

 

USB 메모리를 NTFS로 포맷하고 라즈베리 파이에 연결을 해주고 진행을 계속했습니다.

 

 

1. SSH를 이용해서 라즈베리파이에 접속한 후.. 패지지들을 최신으로 업데이트 해줍니다.

pi@raspberrypi ~ $ sudo apt-get update

pi@raspberrypi ~ $ sudo apt-get upgrade

 

2. git를 설치하려 했는데 이미 설치가 되어 있군요..

pi@raspberrypi ~ $ sudo apt-get install git-core

 

추가로 ntfs를 마운트하기 위한 패키지를 설치해줍니다.

pi@raspberrypi ~ $ sudo apt-get install ntfs-3g

 

3. 라즈베리파이에 연결해둔 USB 메모리가 부팅할 때 마다 자동으로 마운트 되도록 해주어야 합니다. 다음 명령을 사용해주면 usb 메모리의 정보를 확인 할 수 있습니다. 내용을 따로 복사해둡니다.

pi@raspberrypi ~ $ sudo blkid

 

4. 마운트 할 디렉토리를 만들어 줍니다. 저 같은 경우에는 /home/pi/git 가 되겠네요.

pi@raspberrypi ~ $ mkdir git

 

5. /etc/fstab을 수정하여 부팅시마다 자동으로 usb를 /home/pi/git로 마운트 될 수 있도록 해줍니다.

pi@raspberrypi ~ $ sudo nano /etc/fstab

 

UUID=92B68645B68629B5 /home/pi/git ntfs uid=pi,gid=pi,umask=0022,sync,auto,nosuid,rw,nouser,windows_names,locale=ko_KR.UTF-8 0 0

 

6. 재부팅 후… 라즈베리파이에 SSH로 접속해서 새로운 저장소를 하나 생성합니다.

pi@raspberrypi ~/git $ mkdir hello

pi@raspberrypi ~/git $ cd hello

pi@raspberrypi ~/git/hello $ git init --bare hello.git

Initialized empty Git repository in /home/pi/git/hello/hello.git/

 

 

7. PC에 설치된 리눅스에서 테스트 해봅니다.

아이디와 이름을 설정해 주고

~$ git config --global user.name "webnautes"

~$ git config --global user.email webnautes@nate.com

 

디렉토리를 하나 만들어서 c파일 하나를 생성했습니다.

~/hello$ pwd

/home/webnautes/hello

~/hello$ ls

a.out hello.c

 

 

라즈베리파이에 설치된 git 서버에 파일을 올려봅니다.

~/hello$ git init

Initialized empty Git repository in /home/webnautes/hello/.git/

 

~/hello$ git remote add origin pi@192.168.0.11:/home/pi/git/hello/hello.git

 

~/hello$ git add *.c

 

~/hello$ git commit -m "init"

 

~/hello$ git push origin master

 

 

8. 다른 디렉토리에서 파일을 다운로드 받아 봅니다.

~/temp$ git clone pi@192.168.0.11:/home/pi/git/hello/hello.git

~/temp$ ls ./hello/

hello.c

 

 

 

참고

http://www.instructables.com/id/GitPi-A-Private-Git-Server-on-Raspberry-Pi/?ALLSTEPS

https://www.digitalocean.com/community/tutorials/how-to-install-git-on-debian-7

https://help.ubuntu.com/community/MountingWindowsPartitions#Configuring_.2BAC8-etc.2BAC8-fstab

http://rogerdudler.github.io/git-guide/index.ko.html

문제 발생시 지나치지 마시고 댓글 남겨주시면 가능한 빨리 답장드립니다.


제가 쓴 책도 한번 검토해보세요 ^^

+ Recent posts