티스토리 뷰
properties 관련 개인정보 파일은 .gitignore 파일에 업로드 예외 상황으로 둘 수 있다.
git 프로젝트마다 .gitignore 파일이 있으며, 여러 프로젝트로 나뉠 시 각 프로젝트마다 해당 파일이 존재한다.
ex) .gitignore
HELP.md
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/
### CYC ###
**/*.properties
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
### VS Code ###
.vscode/
! 표시는 해당 파일은 포함한다는 뜻이며, ! 붙지 않는 파일은 업로드에 포함하지 않는다는 뜻이다.
properties 파일들을 제외하기 위해 다음 부분을 추가했다.
### CYC ###
**/*.properties
만약 이전에 이미 git이 연동된 상태라면 cache 삭제 후 커밋 푸시를 해줘야 적용된다.
gitbash 터미널을 연결한 후 git project 경로로 들어가서 properties들의 cache를 삭제 시켜준다.
ex)
cd C:/Users/git/mss/src/main/resources
git rm -r --cached application.properties
'.gitignore 작성 > cache 삭제 > 커밋 앤 푸시' 를 완료하면 해당 properties 파일들이 git에서 삭제되고 properties 파일들이 더이상 추적되지 않는다.
만약 cache 삭제까지 완료되어도 커밋앤푸시를 해주지 않으면 계속 properties 파일들이 추적된다.
'형상관리 > Git' 카테고리의 다른 글
05. git - stash, discard (0) | 2021.08.25 |
---|---|
03. git - STS 다른 곳에서 연동 후 서버 런치 안될 때 (0) | 2021.05.01 |
02. STS 변경 사항 Git으로 push & commit 하기 (0) | 2021.04.30 |
01. STS, Git 연동하기 (0) | 2021.04.27 |
댓글