공부/Git

.gitignore 작동하지 않을 때 / application.properties 업로드 안하고 싶을 때

작은소행성 2021. 5. 10. 15:36
반응형

 

DB정보가 담겨있는 application.properties 내용을 깃에 업로드 안하고 싶어서

 

.gitignore 에 다음 경로를 추가했는데 여전히 application.properties 의 내용이 업데이트 되고 있었다. 

 

 

/src/main/resources/application.properties

 

 

gitignore 을 사용하고 싶으면 기존에 버전관리 했던 내용을 삭제해줘야 한다.

git rm --cached D:/Users/Intellij/boardapi/src/main/resources/application.properties

 

위의 명령어 실행 후 변경사항을 푸시하면 

git add .
git commit -m "message"
git push

gitignore 이 정상작동되고 application.properties 가 깃에 업로드 되지 않는다. 

 

728x90