로컬 Git 저장소를 GitHub와 연동하여 코드를 클라우드에 저장하고 공유하는 방법을 실습합니다.
이 글에서 할 것
- GitHub 계정 생성하고 저장소 만들기
- 로컬 저장소와 GitHub 연결하기
- 코드 push/pull 하기
- 저장소 clone 하기
준비물
- Git이 설치된 터미널
- GitHub 계정 (없으면 생성 필요)
- 이전 실습의
my-first-git-project
실습 1: GitHub 계정 생성
GitHub 가입
- github.com 접속
- Sign up 클릭
- 이메일, 비밀번호, 사용자이름 입력
- 이메일 인증 완료
실습 2: GitHub 저장소 생성
새 저장소 만들기
- GitHub에서 + 버튼 클릭
- "New repository" 선택
- Repository name:
my-first-repo - Public 선택
- "Create repository" 클릭
생성 후 화면:
git remote add origin https://github.com/사용자이름/my-first-repo.git
git branch -M main
git push -u origin main
실습 3: 원격 저장소 연결
로컬 프로젝트로 이동
cd ~/my-first-git-project
remote 연결
git remote add origin https://github.com/사용자이름/my-first-repo.git
연결 확인
git remote -v
예상 출력:
origin https://github.com/사용자이름/my-first-repo.git (fetch)
origin https://github.com/사용자이름/my-first-repo.git (push)
💬 댓글
이 글에 대한 의견을 남겨주세요