[final project] git repository(원격저장소) 연결

싱숭생숭어·2023년 8월 2일
0

팀프로젝트

목록 보기
5/6
post-thumbnail

기존 local 프로젝트를 git repository에 연결

1. 기존 프로젝트 폴더 내로 이동

  • cd ./project

2. git 초기화

  • git init

    • 이 작업을 안할경우, 이미 연결되어있던 repository와 데이터를 주고받음

3. git repository 연결

  • git remote add origin git@github.com:리포지토리 주소

    • 연결할 repository가 만들어져 있어야 함

repository 주소는 git hub 홈페이지의 <code>에서 확인 가능

  • git remote -v

    • 현재 연결된 repository 확인

4. git branch

  • git pull origin branch이름

    • 맨 처음 가져오는 branch(main branch)의 경우 git pull origin master
  • git branch

    • 현재 local에 연결된 branch 확인
  • git branch -r

    • 해당 repository에 존재하는 branch 확인
  • git checkout branch이름

    • 해당 branch로 local branch 변경

5. repository 원격 branch로 commit, push

  • git add 파일이름

    • 원격저장소에 올릴 파일 추가, local 폴더에 있는 모든 파일을 올릴 경우, git add .
  • git status

    • commit 하기 전 현재 add한 파일 목록 보여줌
  • git commit -m "commit name"

    • commit 이름 지정하면서 해당 변경사항 commit
  • git push origin branch이름

    • 해당 변경사항 반영해 branch 업로드

6. 변경사항이 적용됐는지 확인

git hub 홈페이지에서 해당 파일이 잘 업로드 된 걸 볼 수 있음

profile
공부합시당

0개의 댓글