nuri-story 2023. 9. 30. 17:58

env 설정 다운

yarn add dotenv

yarn add @nestjs/config

 

.gitignore 기본 세팅

.env
.env.docker
/.clinic
yarn.lock
/.clinic
logstash.conf

# compiled output
/dist
/node_modules

# Logs
logs
*.log
npm-debug.log*
pnpm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# OS
.DS_Store

# Tests
/coverage
/.nyc_output

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

.gitmessage.txt
git_init

/artillery

 

만약에 .env가 깃헙에 올라갔을 경우

git rm .env --cached
git commit -m "remove .env file from git"
git push

 

깃허브의 .env 히스토리 날리기

git filter-branch -f --index-filter 'git rm --cached --ignore-unmatch .env' --prune-empty -- --all
git push --force --all

 

 

참고

https://jjjoonngg.github.io/git/Git-History/

 

Git History 에서 특정 파일 삭제하기

Git 을 사용하다가 보면 private 일 경우에도 remote 에 올리지 말아야할 file 혹은 folder 가 존재 할 수 있다.

jjjoonngg.github.io