관리 메뉴

개발 여행자, 현

[Git] .gitignore에 의해 제외된 파일을 git에 추가하기 본문

Git

[Git] .gitignore에 의해 제외된 파일을 git에 추가하기

예스현 2022. 5. 19. 15:11
.gitignore에 의해 제외된 파일을 git에 추가하기

 

1. 개요

.gitignore에서 제외된 파일을 git에 추가해야되는 상황이 생겼다.

ingore 파일을 수정할 수도 있겠지만 그럼 추후에 다시 수정해야 되기에

git add 명령어를 이용하기로 했다.

 

2. 발생오류

git add test.md

.gitignore에 의해 제외된 파일을 git add 명령어를 이용하여 추가하려고 했는데

다음과 같은 오류가 발생했다.

The following paths are ignored by one of your .gitignore files:
.github/test.md
hint: Use -f if you really want to add them.
hint: Turn this message off by running
hint: "git config advice.addIgnoredFile false"

 

3. 해결방법

git config advice.addIgnoredFile false
// or
git add -f Test.md