https://langeasy.tistory.com/50
.gitignore 이용해서 개인정보 보호하기
기존에 작성했던 application.properties에는 db id, password 그리고 open api의 key 값을 그대로 넣었고 이걸 github에 push를 그대로 했었다. 처음부터 보안에 신경써야 했는데 뒤늦게라도 개인정보를 보호하
langeasy.tistory.com
이렇게 개인정보 및 민감한 정보를 github에 실수로 push했을 때 history를 삭제해야하는 경우가 생긴다.
이때 이렇게 삭제하면 된다.
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch ./src/main/resources/application.properties' --prune-empty --tag-name-filter cat -- --all
기록 삭제하고 싶은 파일 지우기
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch 경로/파일명' --prune-empty --tag-name-filter cat -- --all
실패
unchange라고 되면 경로가 잘못됐거나 기타 오타들로인해 잘 안된 것이다.
성공
라고 떠야 성공한 것
histroy가 삭제 된 모습을 확인 할 수 있다.
반응형