민희의 코딩일지

[Git] github와 git연동 본문

Git

[Git] github와 git연동

heehminh 2021. 12. 27. 01:59
반응형

- 리모트에 연동 (1) 

이 폴더(secondProject)를 내 로컬과 연동을 시키겠다.

git remote add origin https://github.com/heehminh/secondProject.git

git init

git add . 

git commit -m "initial commit" 

 

- 서버에 연동 (2)

git push origin main

로컬에서 변경사항 서버에 반영(동기화)

 

- 서버에서 로컬로 가져오기

git clone 리포지토리 주소(로컬)

>git clone https://github.com/heehminh/secondProject.git
Cloning into 'secondProject'...

: 깃허브 리포지토리에서 모든 커밋들을 내 로컬로 가져온다

 

- 서버에서 변경사항 로컬에 반영

git pull origin main

: 깃허브 리보지토리 메인 브랜치에 현재 커밋들을 넣는다

*참고 master -> main 

 

* gitignore부터 다시 

반응형

'Git' 카테고리의 다른 글

Git 명령어 정리  (1) 2024.09.03
[Git] branch의 이해, merge  (0) 2022.01.21
[Git] 로컬에서 Git을 통해 버전관리  (0) 2021.12.27
Comments