[GitHub] node_modules ignore 안되는 현상

Y_Y·2022년 10월 20일
0

GitHub

목록 보기
3/5
post-thumbnail

으.. 불-편

문제) github Repo에 node_modules이 공유되어서 관리가 어려움, 따라서 node_modules를 제외한 파일들만 관리하고 싶음

tool : VScode

  1. git 명령어를 통해 시도 -> 실패
node_modules/
node_modules\
git rm -r --cached node_modules/ // git repo 캐시 삭제 후 ignore 적용시도
git rm -r --cached node_modules\
git rm -r --cached node_modules
git rm -r --cached . // 전체 삭제 및 초기화

git add .
git commit -m "test"
git push
  1. Repo 삭제 및 재생성 후 npm 설치후 재시도 -> 실패
    싹 다 해봤다
git status --ignored

이 명령어를 통해 node_modules가 적용이 안되어 있음을 확인.

😥

gitignore.io를 통해서 .gitignore 파일 소스를 받아오기도 함.

++

git rm -r --cached .
git add .
git commit -m "text"

tool : IntelliJ

커밋을 한 적이 없음을 확인??

하지만 workspace.xml은 변경되어 있다.

+++

.gitignore 사용 안하고 처리하는 방법

.git/info/exclude

.gitignore와 같은 동일한 파일 규칙을 갖고 있다.

.git/info/exclude 파일을 열어서 위와 같이 수정


수정 후 위와 같이 git update-index --skip-worktree 변경한 exclude 적용

이 로컬저장소에 한하여 node_modules, .idea 폴더 ignore 기능 적용.

휴,, 편-안

++++
모듈을 제외한 후 소스가 실행이 안될 경우 모듈을 다른 디렉토리에 설치한 후 기존 디렉토리의 모듈을 삭제후 옮기세요.

Dev Scroll - exclude 파일 확인

bae - exclude 파일 적용 명령어 확인

profile
남을 위해(나를 위해) 글을 쓰는 Velog

0개의 댓글