본문 바로가기

💖 Java/SpringMVC

[ Spring ] 게시판 만들기(1) - spring 프로젝트와 Git 연동하기 (GitKraken)

728x90

   GitKraken과 Spring 프로젝트 연동하기   

 

  Git에 Repository 생성  

https://github.com

 

GitHub: Where the world builds software

GitHub is where over 56 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 feat...

github.com

 

Git에 로그인 후 Start a project를 눌러 새로운 repository를 생성한다

 

 

Repository 이름public을 체크한 뒤 repository 생성

 

 

Kraken과 연동시키기 위해서 주소를 복사해준다

 


  내 컴퓨터에 repository 클론하기  

 

GitKraken을 실행 후 File -> Clone Repo

 

 

 

Clone -> GitHub.com -> Browse

Browse를 눌러 내 컴퓨터에 repository가 클론될 곳 지정해준다

연동시킬 리포지토리를 선택해 준다! - Eclipse와 연동시 필요함

(이미 GitKraken과 Git계정이 연동되어 있기 때문에 자동으로 만들어둔 Repository가 보임)

그리고 clone the repo!

 

 

Open Now!

 

Initialize!

 

Push -> Submit

 


  Spring 프로젝트 만들기  

 

eclipse 실행 후, File -> new -> Spring Legacy Project

 

 

Use default location 체크 해제 -> Browse

이전 단계에서 만들었던 리포지터리 클론이 생성되었던 폴더를 찾아 설정해준다

그리고 Spring MVC Project 선택 후 Next

 

프로젝트 패키지 명 설정 후 완료!

 

 

이렇게 프로젝트가 생성되고 실행된다면 연동 성공!

 


 

  GitHub에 Push하기  

- 내 컴퓨터에서 변경된 내용을 GitHub의 repository에 업데이트하기

 

 

다시 GitKraken을 실행하여 view changes 클릭

 

 

생성된 파일 중 classpath를 선택하여 오른쪽 마우스 -> Ignore -> Ignore .classpath

 

Ignore!

 

 

.gitignore 파일 선택 -> Edit this file

 

 

기존의 내용은 지우고 아래 내용을 복사해서 넣어준다

# Created by https://www.gitignore.io/api/java,java-web
# Edit at https://www.gitignore.io/?templates=java,java-web
​
### Java ###
# Compiled class file
*.class
​
# Log file
*.log
​
# BlueJ files
*.ctxt
​
# Mobile Tools for Java (J2ME)
.mtj.tmp/
​
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
​
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
​
### Java-Web ###
## ignoring target file
target/
​
# End of https://www.gitignore.io/api/java,java-web

 

 

복사한 내용 삽입 후 Stage File -> save and stage

 

 

staged Files에 변경된 .gitignore 파일을 올려두고, commit 메세지 작성후 commit

 

commit을 진행하면 아래와 같이 마스터에 추가된걸 볼 수 있다

 

 

나머지 변경된 것들을 Commit해주기 위해서 Stage all changes 클릭

Commit!

 

 

마지막으로 Push를 눌러 GitHub에 업데이트 해준다

 

 

GitHub의 Repository에 방금 Push한 내용이 업데이트 된걸 확인할 수 있다!

 

 

 

모든 내용은 이 블로그를 참조하여 작성하였습니다

stajun.tistory.com/m/20

728x90