«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
Archives
Today
Total
관리 메뉴

VIDEOCUBE

GitLab 활용하기 ( Git 등록 ) 본문

프로젝트

GitLab 활용하기 ( Git 등록 )

라떼청년 2017. 11. 22. 00:50


gitLab  에 network 라는 그룹을 만들고 ping 이라는 프로젝트를 생성하였다


Create a new repository
git clone http://git.videocube.lab/network/ping.git
cd ping
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master
Existing folder
cd existing_folder
git init
git remote add origin http://git.videocube.lab/network/ping.git
git add .
git commit -m "Initial commit"
git push -u origin master
Existing Git repository
cd existing_repo
git remote add origin http://git.videocube.lab/network/ping.git
git push -u origin --all
git push -u origin --tags

사용방법은 위와 같이 프로젝트를 생성하면 나와있다.


작업할 리눅스 서버 1대를 접속한 후에

git 을 설치해 보자


root@linux-01:/data/source> yum install git


6가지 를 설치하고 그외 3가지를 update 받으라고 한다.


root@linux-01:/data/source> git


usage: git [--version] [--exec-path[=GIT_EXEC_PATH]] [--html-path]

           [-p|--paginate|--no-pager] [--no-replace-objects]

           [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE]

           [--help] COMMAND [ARGS]


The most commonly used git commands are:

   add        Add file contents to the index

   bisect     Find by binary search the change that introduced a bug

   branch     List, create, or delete branches

   checkout   Checkout a branch or paths to the working tree

   clone      Clone a repository into a new directory

   commit     Record changes to the repository

   diff       Show changes between commits, commit and working tree, etc

   fetch      Download objects and refs from another repository

   grep       Print lines matching a pattern

   init       Create an empty git repository or reinitialize an existing one

   log        Show commit logs

   merge      Join two or more development histories together

   mv         Move or rename a file, a directory, or a symlink

   pull       Fetch from and merge with another repository or a local branch

   push       Update remote refs along with associated objects

   rebase     Forward-port local commits to the updated upstream head

   reset      Reset current HEAD to the specified state

   rm         Remove files from the working tree and from the index

   show       Show various types of objects

   status     Show the working tree status

   tag        Create, list, delete or verify a tag object signed with GPG


See 'git help COMMAND' for more information on a specific command.



videocube 계정을 git 에 설정해야 한다


Git global setup

git config --global user.name "Name" git config --global user.email "Email"


정상적으로 설정이 되었다면 다음 명령어에 설정 된 데이터를 확인 할 수 있다. 


git config --list





Create a new repository
에 README 를 넣어보도록 한다.


root@linux-01:/data/source> git clone http://git.videocube.lab/network/ping.git

Initialized empty Git repository in /data/source/ping/.git/

error: The requested URL returned error: 401 while accessing http://git.videocube.lab/network/ping.git/info/refs


fatal: HTTP request failed



RHEL/CentOS 6 에 있는 1.7.x 대의 git 을 사용하면 발생함



git version 확인



root@linux-01:/data/source> git --version

git version 1.7.1


git를 2.x 로 Upgrade 를 해보자


git 1.8 설치

wget http://springdale.math.ias.edu/data/puias/computational/6/x86_64/git-1.8.3.1-1.sdl6.x86_64.rpm
wget http://springdale.math.ias.edu/data/puias/computational/6/x86_64/perl-Git-1.8.3.1-1.sdl6.noarch.rpm
yum remove git -y
yum localinstall git-*.rpm perl-Git-*.noarch.rpm -y


2.x 설치

2.x 이상을 사용할 경우 Wandisco 사의 repository 를 설치한 후에 yum 으로 설치하면 된다.

CentOS 7

CentOS 7
rpm -Uvh http://opensource.wandisco.com/centos/7/git/x86_64/wandisco-git-release-7-2.noarch.rpm


CentOS 6


repository 설치를 마쳤으면 아래 명령어로 git 을 설치(git-svn 은 subversion 저장소 이관하지 않을 경우 불필요)

yum --enablerepo=WANdisco-git --disablerepo=base,updates install git git-svn


펌) https://www.lesstif.com/pages/viewpage.action?pageId=14745759


root@linux-01:/data/source> git clone http://git.videocube.lab/network/ping.git

'ping'에 복제합니다...

Username for 'http://git.videocube.lab': pluto90k

Password for 'http://pluto90k@git.videocube.lab': 

warning: 빈 저장소를 복제한 것처럼 보입니다.


root@linux-01:/data/source/ping> ls -an

합계 12

drwxr-xr-x. 3 0 0 4096 2017-11-21 23:51 .

drwxr-xr-x. 3 0 0 4096 2017-11-21 23:51 ..

drwxr-xr-x. 7 0 0 4096 2017-11-21 23:51 .git


README.md 를 생성 하고

root@linux-01:/data/source/ping> ll

합계 4

-rw-r--r--. 1 root root 43 2017-11-21 23:55 README.md


root@linux-01:/data/source/ping> git add README.md 

root@linux-01:/data/source/ping> git status

현재 브랜치 master


아직 커밋이 없습니다


커밋할 변경 사항:

  (스테이지 해제하려면 "git rm --cached <파일>..."을 사용하십시오)


새 파일:       README.md


root@linux-01:/data/source/ping> git commit -m "README"

[master (최상위-커밋) b520cb9] README

 1 file changed, 1 insertion(+)

 create mode 100644 README.md



root@linux-01:/data/source/ping> git push -u origin master


Username for 'http://git.videocube.lab': pluto90k

Password for 'http://pluto90k@git.videocube.lab': 

오브젝트 개수 세는 중: 3, 완료.

오브젝트 쓰는 중: 100% (3/3), 260 bytes | 260.00 KiB/s, 완료.

Total 3 (delta 0), reused 0 (delta 0)

To http://git.videocube.lab/network/ping.git

 * [new branch]      master -> master

master 브랜치가 리모트의 master 브랜치를 (origin에서) 따라가도록 설정되었습니다.



src > 소스 폴더를 만들고

build > 빌드 폴더를 만듭니다.


c 파일로 빌드를 해야 하니 당연히 gcc 는 설치해야겠지요




build된 파일은 올릴 필요 없으니 ignore 해놓는다


root@linux-01:/data/source/ping> vi .gitignore

build/*


src 에는 

root@linux-01:/data/source/ping/src> wget https://www.cs.utah.edu/~swalton/listings/sockets/programs/part4/chap18/ping.c

해서 ping.c 소스를 받는다


Makefile 만들기

root@linux-01:/data/source/ping> cat Makefile 

#

## Copyright (c) 2017 VideoCube Lab., Ltd.

# All rights reserved.

# #

# # $Id: Makefile 447 2017-11-21 12:12:00Z pluto90k $

# #


TARGET=ping

SOURCE=src

OUTPUT=build/bin


all: clean

$(shell mkdir -p $(OUTPUT))

gcc -o $(OUTPUT)/ping $(SOURCE)/ping.c

clean: 

-rm -f $(OUTPUT)/ping



root@linux-01:/data/source/ping> make

rm -f ./build/ping

gcc -o ./build/ping ./src/ping.c

./src/ping.c:94:1: warning: "ICMP_DEST_UNREACH" redefined

In file included from ./src/ping.c:72:

/usr/include/netinet/ip_icmp.h:49:1: warning: this is the location of the previous definition

./src/ping.c:95:1: warning: "ICMP_NET_UNREACH" redefined

/usr/include/netinet/ip_icmp.h:65:1: warning: this is the location of the previous definition

./src/ping.c:96:1: warning: "ICMP_HOST_UNREACH" redefined

/usr/include/netinet/ip_icmp.h:66:1: warning: this is the location of the previous definition

./src/ping.c:97:1: warning: "ICMP_PORT_UNREACH" redefined

/usr/include/netinet/ip_icmp.h:68:1: warning: this is the location of the previous definition

./src/ping.c:98:1: warning: "ICMP_PROT_UNREACH" redefined

/usr/include/netinet/ip_icmp.h:67:1: warning: this is the location of the previous definition

./src/ping.c:99:1: warning: "ICMP_FRAG_NEEDED" redefined

/usr/include/netinet/ip_icmp.h:69:1: warning: this is the location of the previous definition

./src/ping.c:100:1: warning: "ICMP_SR_FAILED" redefined

/usr/include/netinet/ip_icmp.h:70:1: warning: this is the location of the previous definition

./src/ping.c:101:1: warning: "ICMP_NET_UNKNOWN" redefined

/usr/include/netinet/ip_icmp.h:71:1: warning: this is the location of the previous definition

./src/ping.c:102:1: warning: "ICMP_HOST_UNKNOWN" redefined

/usr/include/netinet/ip_icmp.h:72:1: warning: this is the location of the previous definition

./src/ping.c:103:1: warning: "ICMP_HOST_ISOLATED" redefined

/usr/include/netinet/ip_icmp.h:73:1: warning: this is the location of the previous definition

./src/ping.c:104:1: warning: "ICMP_NET_UNR_TOS" redefined

/usr/include/netinet/ip_icmp.h:76:1: warning: this is the location of the previous definition

./src/ping.c:105:1: warning: "ICMP_HOST_UNR_TOS" redefined

/usr/include/netinet/ip_icmp.h:77:1: warning: this is the location of the previous definition

./src/ping.c:106:1: warning: "ICMP_SOURCE_QUENCH" redefined

/usr/include/netinet/ip_icmp.h:50:1: warning: this is the location of the previous definition

./src/ping.c:107:1: warning: "ICMP_REDIR_NET" redefined

/usr/include/netinet/ip_icmp.h:84:1: warning: this is the location of the previous definition

./src/ping.c:108:1: warning: "ICMP_REDIR_HOST" redefined

/usr/include/netinet/ip_icmp.h:85:1: warning: this is the location of the previous definition

./src/ping.c:109:1: warning: "ICMP_REDIR_NETTOS" redefined

/usr/include/netinet/ip_icmp.h:86:1: warning: this is the location of the previous definition

./src/ping.c:110:1: warning: "ICMP_REDIR_HOSTTOS" redefined

/usr/include/netinet/ip_icmp.h:87:1: warning: this is the location of the previous definition

./src/ping.c:111:1: warning: "ICMP_TIME_EXCEEDED" redefined

/usr/include/netinet/ip_icmp.h:53:1: warning: this is the location of the previous definition

./src/ping.c:112:1: warning: "ICMP_EXC_TTL" redefined

/usr/include/netinet/ip_icmp.h:90:1: warning: this is the location of the previous definition

./src/ping.c:113:1: warning: "ICMP_EXC_FRAGTIME" redefined

/usr/include/netinet/ip_icmp.h:91:1: warning: this is the location of the previous definition

./src/ping.c:114:1: warning: "ICMP_PARAMETERPROB" redefined

/usr/include/netinet/ip_icmp.h:54:1: warning: this is the location of the previous definition

./src/ping.c:115:1: warning: "ICMP_TIMESTAMP" redefined

/usr/include/netinet/ip_icmp.h:55:1: warning: this is the location of the previous definition

./src/ping.c:116:1: warning: "ICMP_TIMESTAMPREPLY" redefined

/usr/include/netinet/ip_icmp.h:56:1: warning: this is the location of the previous definition

./src/ping.c:117:1: warning: "ICMP_INFO_REQUEST" redefined

/usr/include/netinet/ip_icmp.h:57:1: warning: this is the location of the previous definition

./src/ping.c:118:1: warning: "ICMP_INFO_REPLY" redefined

/usr/include/netinet/ip_icmp.h:58:1: warning: this is the location of the previous definition

./src/ping.c: In function ‘main’:

./src/ping.c:498: warning: passing argument 6 of ‘recvfrom’ from incompatible pointer type

/usr/include/sys/socket.h:166: note: expected ‘socklen_t * __restrict__’ but argument is of type ‘size_t *’


소스 분석은 추후에 해보고 build 폴더에 가면 ping 이 존재 할 것이다


root@linux-01:/data/source/ping/build> ./ping 

usage: ping [-LRdfnqrv] [-c count] [-i wait] [-l preload]

[-p pattern] [-s packetsize] [-t ttl] [-I interface address] host


root@linux-01:/data/source/ping> make clean

rm -f ./build/ping


root@linux-01:/data/source/ping> tree

.

├── Makefile

├── README.md

└── src

    └── ping.c


2 directories, 3 files


총 정리된 파일은 .gitignore 포함 3개가 될 것이다


root@linux-01:/data/source/ping> git add .


root@linux-01:/data/source/ping> git status

현재 브랜치 master

브랜치가 'origin/master'에 맞게 업데이트된 상태입니다.


커밋할 변경 사항:

  (스테이지 해제하려면 "git reset HEAD <파일>..."을 사용하십시오)


새 파일:       .gitignore

새 파일:       Makefile

새 파일:       src/ping.c


root@linux-01:/data/source/ping> git commit -m "ping.c init"

[master 5cabfa0] ping.c init

 3 files changed, 1206 insertions(+)

 create mode 100644 .gitignore

 create mode 100644 Makefile

 create mode 100644 src/ping.c



root@linux-01:/data/source/ping> git push -u origin master

Username for 'http://git.videocube.lab': pluto90k

Password for 'http://pluto90k@git.videocube.lab': 

오브젝트 개수 세는 중: 6, 완료.

오브젝트 압축하는 중: 100% (4/4), 완료.

오브젝트 쓰는 중: 100% (6/6), 10.47 KiB | 3.49 MiB/s, 완료.

Total 6 (delta 0), reused 0 (delta 0)

To http://git.videocube.lab/network/ping.git

   b520cb9..5cabfa0  master -> master

master 브랜치가 리모트의 master 브랜치를 (origin에서) 따라가도록 설정되었습니다.


build 는 환경에 따라 Makefile 에서 생성하도록 했다


root@linux-01:/data/source/ping> git commit -m "Makefile Mkdir 로직 추가"

[master fb26c5d] Makefile Mkdir 로직 추가

 2 files changed, 6 insertions(+), 3 deletions(-)



root@linux-01:/data/source/ping> git push -u origin master

Username for 'http://git.videocube.lab': pluto90k

Password for 'http://pluto90k@git.videocube.lab': 

오브젝트 개수 세는 중: 4, 완료.

오브젝트 압축하는 중: 100% (3/3), 완료.

오브젝트 쓰는 중: 100% (4/4), 601 bytes | 601.00 KiB/s, 완료.

Total 4 (delta 0), reused 0 (delta 0)

To http://git.videocube.lab/network/ping.git

   5cabfa0..fb26c5d  master -> master

master 브랜치가 리모트의 master 브랜치를 (origin에서) 따라가도록 설정되었습니다.



미션 완료... 

젠키스를 이용하여 RPM 을 만들어서 RPM 서버로 배포해 보자






반응형
Comments