- Git 설치 확인
git --version
- 원하는 폴더로 이동
cd Project/
- Git 초기화
git init
- Github 원격 저장소와 연결
git remote add origin https://github.com/helena-lena/{repository}.git
- 현재 repository에만 Git 사용자 정보 등록
git config user.name helena-lena
git config user.email {email}
- local branch 확인
git status
- On branch master → 현재 branch는 main이 아니라, master
- Github branch 확인
git remote show origin
- local branch를 master에서 main으로 변경
git branch -m master main
- Commit
- add
- 특정 파일만 업로드: git add file1.txt file2.conf
- 특정 폴더만 업로드: git add src/
- .gitignore 작성 후 전체 업로드: git add .
- git commit -m "메시지" # 로컬 저장소에 저장(커밋)
- Push
git push origin main
- 혹시 Github main에 뭔가 있는데, local main에는 없다면 에러 발생
- pull: git pull --rebase origin main
- 다시 push: git push origin main