티스토리 뷰

Server

나도 Git 한번 써보자

YCPark 2017. 4. 18. 18:33

Git 설치

그동안 미뤄 왔던 Git를 시작해 보고자 한다.

일단은 설치 부터!


OS는 CentOS7으로 시작.

yum 을 이용해서 git를 설치 하였다.

yum -y update
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.daumkakao.com
 * epel: mirror.premi.st
 * extras: ftp.daumkakao.com
 * remi-safe: mirrors.mediatemple.net
 * updates: ftp.daumkakao.com
No packages marked for update

yum install -y git
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.daumkakao.com
 * epel: mirror.premi.st
 * extras: ftp.daumkakao.com
 * remi-safe: mirrors.mediatemple.net
 * updates: ftp.daumkakao.com
Resolving Dependencies
--> Running transaction check
---> Package git.x86_64 0:1.8.3.1-6.el7_2.1 will be installed
--> Processing Dependency: perl-Git = 1.8.3.1-6.el7_2.1 for package: git-1.8.3.1-6.el7_2.1.x86_64
--> Processing Dependency: perl(Term::ReadKey) for package: git-1.8.3.1-6.el7_2.1.x86_64
--> Processing Dependency: perl(Git) for package: git-1.8.3.1-6.el7_2.1.x86_64
--> Processing Dependency: perl(Error) for package: git-1.8.3.1-6.el7_2.1.x86_64
--> Processing Dependency: libgnome-keyring.so.0()(64bit) for package: git-1.8.3.1-6.el7_2.1.x86_64
--> Running transaction check
---> Package libgnome-keyring.x86_64 0:3.8.0-3.el7 will be installed
---> Package perl-Error.noarch 1:0.17020-2.el7 will be installed
---> Package perl-Git.noarch 0:1.8.3.1-6.el7_2.1 will be installed
---> Package perl-TermReadKey.x86_64 0:2.30-20.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================
 Package                                Arch                         Version                                  Repository                  Size
===============================================================================================================================================
Installing:
 git                                    x86_64                       1.8.3.1-6.el7_2.1                        base                       4.4 M
Installing for dependencies:
 libgnome-keyring                       x86_64                       3.8.0-3.el7                              base                       109 k
 perl-Error                             noarch                       1:0.17020-2.el7                          base                        32 k
 perl-Git                               noarch                       1.8.3.1-6.el7_2.1                        base                        53 k
 perl-TermReadKey                       x86_64                       2.30-20.el7                              base                        31 k

Transaction Summary
===============================================================================================================================================
Install  1 Package (+4 Dependent packages)

Total download size: 4.6 M
Installed size: 23 M
Downloading packages:
(1/5): libgnome-keyring-3.8.0-3.el7.x86_64.rpm                                                                          | 109 kB  00:00:00     
(2/5): perl-Git-1.8.3.1-6.el7_2.1.noarch.rpm                                                                            |  53 kB  00:00:00     
(3/5): perl-TermReadKey-2.30-20.el7.x86_64.rpm                                                                          |  31 kB  00:00:00     
(4/5): git-1.8.3.1-6.el7_2.1.x86_64.rpm                                                                                 | 4.4 MB  00:00:00     
(5/5): perl-Error-0.17020-2.el7.noarch.rpm                                                                              |  32 kB  00:00:00     
-----------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                          6.4 MB/s | 4.6 MB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 1:perl-Error-0.17020-2.el7.noarch                                                                                           1/5 
  Installing : libgnome-keyring-3.8.0-3.el7.x86_64                                                                                         2/5 
  Installing : perl-TermReadKey-2.30-20.el7.x86_64                                                                                         3/5 
  Installing : git-1.8.3.1-6.el7_2.1.x86_64                                                                                                4/5 
  Installing : perl-Git-1.8.3.1-6.el7_2.1.noarch                                                                                           5/5 
  Verifying  : perl-Git-1.8.3.1-6.el7_2.1.noarch                                                                                           1/5 
  Verifying  : perl-TermReadKey-2.30-20.el7.x86_64                                                                                         2/5 
  Verifying  : libgnome-keyring-3.8.0-3.el7.x86_64                                                                                         3/5 
  Verifying  : 1:perl-Error-0.17020-2.el7.noarch                                                                                           4/5 
  Verifying  : git-1.8.3.1-6.el7_2.1.x86_64                                                                                                5/5 

Installed:
  git.x86_64 0:1.8.3.1-6.el7_2.1                                                                                                               

Dependency Installed:
  libgnome-keyring.x86_64 0:3.8.0-3.el7            perl-Error.noarch 1:0.17020-2.el7            perl-Git.noarch 0:1.8.3.1-6.el7_2.1           
  perl-TermReadKey.x86_64 0:2.30-20.el7           

Complete!

끝난거 같다.


사실 Github 가입은 미리 해 두었다.

일단 레포지토리를 생성.


Repository name 을 입력하고 하단에 Create repogitory 버튼을 클릭하면


레포지토리 생성이 완료.

셋업 방법이 상세하게 나온다.

뭔지는 잘 몰라도 이대로 따라 해 보자.

echo "# test" >> README.md
git init
Initialized empty Git repository in /home/centos/.git/
git add README.md

git commit -m "first commit"
[master (root-commit) bb64be0] first commit
 Committer: root 
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:

    git config --global user.name "Your Name"
    git config --global user.email you@example.com

After doing this, you may fix the identity used for this commit with:

    git commit --amend --reset-author

 1 file changed, 1 insertion(+)
 create mode 100644 README.md

git remote add origin https://github.com/yoonchulpark/test.git

git push -u origin master
Username for 'https://github.com': yoonchulpark
Password for 'https://yoonchulpark@github.com': 
Counting objects: 3, done.
Writing objects: 100% (3/3), 234 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://github.com/username/test.git
 * [new branch]      master -> master
Branch master set up to track remote branch master from origin.

뭔진 잘 몰라도 대충 echo "# test" 라고 입력하고 commit 하면서 메시지를 "first commit"이라고 지정하면서 name 과 비밀번호를 입력 한거 보니 push 작업을 한거 같다.

이제 해당 github 페이지를 들어 가 보면


커밋이 완료 완료 되어 있다.

README.md 파일을 수정 해 보자.


vi README.md 

# test 라고 입력된 부분을 수정해 보자.

# hello git!

저장하고 git add 하고

git add README.md

commit name 지정하고

git commit -m "second commit"
[master d03ed6e] second commit
 Committer: root 
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:

    git config --global user.name "Your Name"
    git config --global user.email you@example.com

After doing this, you may fix the identity used for this commit with:

    git commit --amend --reset-author

 1 file changed, 1 insertion(+), 1 deletion(-)

Push 하면

git push -u origin master
Username for 'https://github.com': yoonchulpark
Password for 'https://yoonchulpark@github.com': 
Counting objects: 5, done.
Writing objects: 100% (3/3), 273 bytes | 0 bytes/s, done.


뭔가 또 완료 된것 같다.

이제 해당 github 페이지를 들어 가 보면

변경 되어 있다.

이제 첫걸음마를 띠었따. 허허허

'Server' 카테고리의 다른 글

AWS-ec2 PEM키 없이 Password 접속 사용자 생성  (0) 2017.06.09
SVN 설치  (0) 2017.04.18
서버부터 세팅하자  (0) 2017.04.06
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   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
글 보관함