-
기존 프로젝트를 git repository에 연결Git 2023. 1. 11. 17:24
1. 기존 프로젝트 폴더 내에 git bash 등으로 진입
cd myProject
2. git 초기화
git init
완료 메시지 : Initialized empty Git repository in C:/myProject/.git/
3. github 또는 bitbucket 등 프로젝트를 연결 할 repository 생성 또는 링크 가져오기
이미지는 예시일 뿐입니다. 4. repository 연결
git remote add origin https://github.com/???/Test.git
연결된 repo 확인 (fetch / push 주소 확인)
git remote -v
5. 새 repository에서 내용을 pull 받음으로써 git history를 동기화
git pull origin master
현재는 master브랜치가 main브랜치로 변경되었습니다.
6. 새 repository에 파일을 업로드 하기 위해 스테이지에 파일 올림
git add .
git add . 은 모든 파일을 스테이지에 올린다는 뜻
7. 최초 커밋
git commit -m "first commit"
8. repository에 파일 업로드
git push -u origin master
-u 옵션은 이 다음부터는 git pull / git push 를 할 때 origin master 를 지정하지 않아도 알아서 origin master로 붙어서 가져오라는 옵션
728x90'Git' 카테고리의 다른 글
fork와 clone 차이 (0) 2023.01.11 branch 병합과 삭제 (0) 2023.01.11 GIT BASH에서 FATAL: PROTOCOL 'HTTPS' IS NOT SUPPORTED 에러 (0) 2023.01.11 config 삭제 와 등록하기 (0) 2023.01.11 Branch전략-githubFlow (0) 2023.01.05