Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
Tags
- Servlet
- stack
- ArrayList
- interprter
- web
- url
- HashMap
- git push
- MAP
- 스레드
- maven
- heap
- 이진탐색트리
- ssd
- JIT 컴파일러
- desc
- master db
- 멀티스레드
- 서버 이중화
- Nginx 실행 에러
- Git
- RAM
- null
- queue
- cpu
- 정렬
- slave db
- 자바 프로그램 실행과정
- address family
- HDD
Archives
- Today
- Total
Having
[Git] .gitignore 에 .classpath .project target/ 추가하고 push해도, 원격저장소에 파일이 그대로인 이유와 해결방법 본문
Git
[Git] .gitignore 에 .classpath .project target/ 추가하고 push해도, 원격저장소에 파일이 그대로인 이유와 해결방법
GHM 2022. 1. 25. 19:52문제과정:
1) .gitignore 없이 git commit->push
2) 불필요한 파일들(.classpath, .project, target 폴더)까지 모두 업로드(push) 됨
3) .gitignore 텍스트 파일에 (.classpath, .project, target/) 추가 -> git add -> git commit -> git push
결과 : 깃허브에 '.classpath, .project, target폴더' 가 삭제되지 않고 그대로 존재..
gitignore 가 적용되지 않았음
원인 :
git add/commit하는 순간,
해당 파일들은 tracking 되고 있기 때문에, gitignore에 추가해도 작동하지 않음.
해결방법 :
git cache(캐시)를 삭제하고, 다시 커밋/푸쉬 해야한다.
git rm -r --cached .
git add .
git commit -m "clear git cache"
1. git rm -r --cached
: cache에 기록된 tracking 중인 파일리스트 삭제
git rm --cached 후, 상태확인
2. git add
3. git commit
4. git push
: .classpath, .project, target폴더 가 삭제되었다.