티스토리 뷰

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 파일들이 추적된다.

 

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
more
«   2025/04   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30
글 보관함