21.1.11

커피 내리는 그냥 사람·2021년 1월 11일
1

위코드 사전스터디

목록 보기
6/36

#1. 수강 과목 : Git 이론
#2. 수강 콘텐츠 : 생활코딩 Git강의 정리

<백업>

  1. 용어 정리
  • local repository(지역 저장소)

(push) 원격 저장소로 백업 : 이를 통한 백업
(pull) 원격에서 다운로드

  • remote repository(원격 저장소)

(clone) : 다른 컴퓨터로 복사

pull, push, clone 으로 세 컴퓨터가 서로 백업과 작업을 할 수 있다.

  1. git hosting 선택 : 깃허브

  2. 저장소 생성 : repository 만들어보기

  3. 원격 저장소와 연결(HTTP 방식)
    branch 수업에서 만든 manual2에 word.txt로 실습 시작

…or push an existing repository from the command line

git remote add origin https://github.com/damin0320/my-repo.git
git branch -M main
git push -u origin main

활용

(base) daminan@andamin-ui-MacBookAir manual2 % git remote add origin https://github.com/damin0320/my-repo.git 
(base) daminan@andamin-ui-MacBookAir manual2 % git remote
orgin
(base) daminan@andamin-ui-MacBookAir manual2 % git remote -v
orgiin	https://github.com/damin0320/my-repo.git (fetch)
origin	https://github.com/damin0320/my-repo.git (push)

origin 은 뒤에 주소에 대한 별명을 통칭하는 단어라고 함.
즉 내가 하고 있는 work.txt라는 파일을 푸쉬하기 전 원격 저장소와 연결하는 작업을 한 것임.(git remote)
(나는 오타쳐서 orgin이라고 함..)

  1. push
git push --set-upstream orgin master

orgin 은 내가 설정한 이름. 저렇게 하면 푸쉬가 끝남.(깃허브에 저장 됨.)

이후 내가 원하는데로 수정 후 add, commit 후 다시 git push 하면 동기화 됨.

  1. clone

먼저 지역 저장소 내용 복사

git clone https://github.com/damin0320/my-repo.git

이럴 경우 my-repo 가 복사 됨.

  1. pull
    다른 컴퓨터에서 업데이트 한 내용을
git pull

하면 똑같은 것을 다운 받을 수 있다.(컴이 두 대가 아니라 이건 실습 안 함)

일단 내일 깃에 대한 내용 다 복습해보고 실제로 만든 파일을 지워질지 모르니 백업해놓고 깃에 올리는 연습을 해봐야겠다.

profile
커피 내리고 향 맡는거 좋아해요. 이것 저것 공부합니다.

0개의 댓글