소스의 버전을 관리하기 위해 git을 사용한다. 소스를 공유하기 위해 github를 사용한다. 여러 명이 개발작업을 동시에 하기 위해 github을 사용한다. 4가지 단계를 거치면 git을 사용할 수 있다. 1. Git hub가입 2. pc에 Git 유틸 설치 3. 내 pc와 Git hub 연결하기 4. Git에 데이터 올리기와 내리기 <1> Git hub가입 <2> Git 사용법 요약 <3> 원격에 있는 github 관리하기 <4> Git branch를 사용해보자 <1> Git hub가입 1. Git hub 인터넷에 저장하는 공간이다. 1) Git hub 회원가입 https://github.com/login 구글로 가입 2) Start a project + > New 레파지토리 해서 리포지토리를 만든다. memo1 2. pc에 Git 유틸 설치 Git은 github에 올리는 프로그램이다. 1) Git 유틸리티 다운로드 1 https://git-scm.com/downloads #기타 - 리눅스에 git , docker 설치한다. yum install git -y 3. 내 pc와 Git hub 연결하기 내 pc에 디렉터리 만들고 Git 레파지토리와 연결하기 1) 내 pc에 1git 디렉터리를 만든다. 2) 만든 폴더에서 오른 마우스 1git클릭 오른마우스 > 추가 옵션 > Open Git Bash here 클릭 글자를 좀 크게 한다 - 옵션 - text - select - 20 크기로 3) 우선 내 정보를 입력한다. git config --global user.name "taeho" git config --global user.email "topasvga@naver.com" 4) Git 초기화 git init Initialized empty Git repository in C:/1 git/. git/ # master 로 지정 됩니다. , . git파일이 생깁니다. 5) Git hub 이름 origin으로 정하기 git remote add origin https://github.com/topasvga1/memo1.git # git remote add origin 리파지토리 주소. # 리파지토리 주소는 github에 Code클릭하면 HTTPS 주소가 있다. https://github.com/login 4. Git에 데이터 내리기와 올리기 # git 사용 형식 : git 명령어 1) 내리기 pull git pull 2) 올리기 push : git push # git push origin master # git 명령어 저장소 대상 4) web1.txt라는 파일 하나를 만든다. touch web.txt 5) 변경된거 있는지 확인 git status # 로컬 폴더와 git상의 데이터와 동기화 확인. On branch master No commits yet Untracked files: (use "git add ..." to include in what will be committed) web.txt nothing added to commit but untracked files present (use "git add" to track) 6) 추가하기 git add . # git add 로 추가 한다. 대신 점(.)으로 해도 된다. 7) 변경된 로그 확인 git log # 아직 commit(스넵샷)을 찍지는 않았다고 나온다. fatal: your current branch 'master' does not have any commits yet jasmin92@DESKTOP-5MQ01DD MINGW64 /c/2git (master) 8) 커밋, 해당시점 스넵셧 찍어놓기. 코멘트 달기 (-m 메시지이다) git commit -m "add 111" warning: LF will be replaced by CRLF in web01.txt. The file will have its original line endings in your working directory 9) 마스터에 올리기 git push origin master # github 계정과 암호를 물어본다. # 나는 구글 otp 인증 사용 # github에 파일이 올라간다 # 인증방식이 ID , Password 방식에서 토큰 방식으로 변경되었습니다. 아래 참조 https://brunch.co.kr/@topasvga/3669 10) 웹브라우저로 github에 올라갔는지 확인한다. https://github.com/login https://github.com/topasvga1/memo1 참고 : # 원격 오리진 확인 git remote -v origin https://github.com/topasvga1/taeho.git (fetch) origin https://github.com/topasvga1/taeho.git (push) # 원격 오리진 삭제 git remote rm origin # 원격 오리진 확인 git remote -v <2> Git 사용법 요약 1) github가입하고, git cli 설치 2) git 환경설정 - 계정설정, github와 내pc git디렉토로와 연결하기 3) git cli 에서 > 파일을 만들고 > add . > Commit > push해서 Github에 올리기 순서로 한다. 실습2 touch web2.txt git add . git commit -m "change1" git remote add origin https://github.com/topasvga1/memo1.git git log git push origin master # 웹브라우저에서 파일 올라간거 확인 https://github.com/topasvga1/memo1 감사합니다.