본문 바로가기

IT

Git 푸시하기

+모든 코드는 터미널 또는 cmd에서 진행해주세요

Git사용자 등록

 

$ git config --global user.email "[이메일주소]" //email을 등록
$ git config --global user.name "[이름]" //name을 등록

 

 

Git 저장소 생성 및 commit 생성

 

$ cd [올릴 파일이 있는 경로]
$ git init //여기서 master브랜치가 추가됩니다.
$ git add .
$ git commit -m "[메세지]" ex)first commit 등 다양한 commit을 남겨주세요

 

여기까지 했다면 저장은 된 셈이다.

 

이제 파일을 올려보도록 한다.

(주의) 올릴 repository를 만들어놓고 해보자.

$ git remote add origin [git 온라인 저장소 주소.git] //깃허브에서 자신의 repository의 git 주소를 알려준다.
$ git push -u origin master

 

만약 서버에서 push하는 거라면,

 

$ git remote set-url origin https://github.com/username/repository.git

 

이렇게 remote set-url을 해주고 푸시하자