.gitignore 란?
특정 파일이나 디렉토리를 git 버전 관리에서 의도적으로 추적하지 않도록 설정하는 파일이다.
로그, 컴파일 파일 같은 용량이 큰 파일 또는 보안 관련 키 파일이 포함될 수 있다.
1. .gitignore 파일 만들기
항상 폴더의 최상단에 존재해야 한다.
2. 적용하기
gitignore 파일을 commit 후 push 한다.
[문법]
# : comments
# no .a files
*.a
# but do track lib.a, even though you're ignoring .a files above
!lib.a
# only ignore the TODO file in the current directory, not subdir/TODO
/TODO
# ignore all files in the build/ directory
build/
# ignore doc/notes.txt, but not doc/server/arch.txt
doc/*.txt
# ignore all .pdf files in the doc/ directory
doc/**/*.pdf
만약 이미 해당 파일이 깃허브에 업로드되어 있다면 레퍼지토리에서 삭제 후 다시 push 하거나, 다음 명령어를 입력해줘야 한다.
git rm -r --cached .
git add .
git commit -m "clear git cache"
git push
gitignore에 들어갈 내용은 다음 사이트를 참고해 복사, 붙여넣기 하면 된다.
https://www.toptal.com/developers/gitignore
gitignore.io
Create useful .gitignore files for your project
www.toptal.com
'내배캠 > TIL' 카테고리의 다른 글
오브젝트와 의존관계 (0) | 2024.08.09 |
---|---|
DTO, DAO, VO (0) | 2024.08.08 |
24. 08. 06 (0) | 2024.08.06 |
Stateless (0) | 2024.08.06 |
Java 날짜 함수 (4) | 2024.08.05 |