Study/Git

[Git] 로컬 저장소와 원격저장소 공유

Loafly 2020. 10. 13. 13:57
728x90

(1) Git이 안되어있는 경우

원하는 프로젝트 폴더에서 Git 생성

git init

add와 Commit

git add *
git commit -m "Hello World"

기본 Branch 생성

git branch -M main

GitHub 사이트에서 Project 생성 후 원격저장소 연동

git remote add origin https://github.com/_RepositoriesName_/_NewProjectName_.git

GitHub 사이트에 폴더 push

git push -u origin main

(2) Git은 있으며 GitHub와 연동

기본 Branch 생성

git branch -M main

GitHub 사이트에서 Project 생성 후 원격저장소 연동

git remote add origin https://github.com/_RepositoriesName_/_NewProjectName_.git

GitHub 사이트에 폴더 push

git push -u origin main

 

반응형