What I Learned/Framework
[Git] GitHub 빈 repository에 로컬 프로젝트 push하기
Interrobang
2023. 8. 4. 21:31
1. 아래 상태처럼 빈 repository를 만들기
2. 프로젝트 디렉토리에서 Git Bash(Window) or 터미널(Mac)을 실행해 명령어를 입력한다.
깃 초기화
git init
상태 확인(필수 x)
git status
모든 파일 staging area로 이동
git add .
상태 확인(필수 x)
git status
커밋
git commit -m "커밋 메세지"
브랜치 이동 (github 기본 브랜치와 맞춤)
git branch -M main
** 매번 하기 귀찮으면
git config --global init.defaultBranch main
** 설정 확인
git config --get init.defaultBranch
GitHub repository와 연결
git remote add origin https://github.com/interrobang3544/test.git
push
git push -u origin main