✅ github에 원격 저장소 생성하기
✅ 셋업 방법
echo "# market-bapp-private" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/seowlee/market-bapp-private.git
git push -u origin main
혹은
git remote add origin https://github.com/seowlee/market-bapp-private.git
git branch -M main
git push -u origin main
✅ 로컬 저장소 파일들 원격저장소에 올리기 상세 설명
로컬 저장소에 원격저장소 등록하기
로컬에서 원격저장소로 push 할 파일들이 있는 위치로 이동하기
아래 명령어를 통해 로컬 저장소에 원격저장소 등록하기
git remote add origin https://github.com/seowlee/market-bapp-private.git
현재 브랜치를 main으로 강제 이동시키기
git branch -M main
아래 명령어를 통해 현재 브랜치 확인해보기
git branch
🔍 -M 옵션의 의미
옵션 | 의미 |
-m | rename (이름 변경) — 기존 이름과 충돌하면 오류 발생 |
-M | move/force rename (강제 이름 변경) — 기존에 main 브랜치가 있어도 덮어씀 ✅ |
git add
Working Directory에서 작업한 파일들을 staging Area로 옮기기
그 전에 상태 확인해보기
git status
수정된 파일들 add 하기
git add .
git commit
staging Area에 저장된 변경사항을 local repository에 등록 (변경사항 확정)
// git commit -m "커밋메시지"
git commit -m "Market BApp for deployment to production"
git push
commit 이력을 github remote repository에 업로드
push를 통해 로컬 저장소와 원격저장소의 상태가 같아짐
git push -u origin main
✅github 원격저장소로 이동해 확인
참고 :
https://chancoding.tistory.com/76
'Git' 카테고리의 다른 글
[Git] Git에서 일부 폴더만 작업 후 push 했을 때 생기는 문제와 안전한 대처법 (0) | 2025.04.10 |
---|---|
[Git] git 특정 커밋 다운 (1) | 2024.05.08 |
[Git] git clone change directory name (2) | 2024.01.03 |
[Git] 강제 pull 하기 (0) | 2023.11.02 |
[Git] git clone 특정 브랜치 (0) | 2023.11.01 |
댓글