이전 포스팅에서는 Intellij에서 git repository를 생성해서 연결하였다.
2023.03.26 - [DevOps/Git] - [Git] Intellij 스프링부트 프로젝트 GitHub 연결하기
[Git] Intellij 스프링부트 프로젝트 GitHub 연결하기
스프링부트 프로젝트 깃허브 저장소 생성 및 연동 스프링부트 프로젝트를 만든 후에 깃허브에 연결하는 방법으로 프로젝트를 먼저 생성해야 한다. 아래 게시글을 참고하여 프로젝트를 생성한
lims-dev.tistory.com
이번 포스팅에서는 GitHub에서 Repository를 생성한 후에 프로젝트를 연결하는 방법을 알아본다.
Git Repository 생성
먼저, github 홈페이지에 접속하여 로그인한다.
GitHub: Let’s build from here
GitHub is where over 100 million developers shape the future of software, together. Contribute to the open source community, manage your Git repositories, review code like a pro, track bugs and fea...
github.com
로그인 후 [New] 버튼을 누른 후
repository 이름, 설명을 입력한 후 [Create] 버튼을 누른다.


repository가 생성되면, 아래 이미지와 같은 화면을 볼 수 있다.
표시한 부분이 방금 생성한 repository의 주소이다.

터미널을 통해 Repository 연결
오늘은 Intellij에서 터미널로 연결하기 위해 아래 터미널에 접속한다.

1. git init는 저장소를 초기화 하기 위한 명령어 이다.
먼저 저장소를 초기화 해준다.
git init
2. git repository에 연결한다.
$ git remote add origin https://github.com/selimkim/oauth_test.git
//연결된 repo 확인
$ git remote -v
origin https://github.com/selimkim/oauth_test.git (fetch)
origin https://github.com/selimkim/oauth_test.git (push)
3. 모든 파일을 스테이지에 올린다.
$ git add .
4. 최초 커밋을 수행한다.
$ git commit -m "설명"

5. repository에 커밋한 파일을 올린다.
$ git push -u origin master
'DevOps > Git' 카테고리의 다른 글
| [Git] Git + Netlify를 사용하여 사이트 배포하기(무료 호스팅 하는 방법) (0) | 2023.04.23 |
|---|---|
| [Git] Git push Error 해결 방법 - Git push 오류 발생 (0) | 2023.04.01 |
| [Git] Intellij 스프링부트 프로젝트 GitHub 연결하기 (1) (0) | 2023.03.26 |