.envํ์ผ์ .gitignore์ ์์ฑํ์ง ์๊ณ ๊นํ๋ธ์ pushํ์ ๋ ๋์ฒ๋ฒ
1. gitignore ํ์ผ ์์ .env ํ์ผ ๋ชฉ๋ก๋ค์ ์์ฑํ๋ค.
2. git ์บ์๋ฅผ ์ญ์ ๋ช ๋ น์ด๋ฅผ ์ฌ์ฉํด์ ํด์ tracking ๋๊ณ ์๋ ํ์ผ๋ค์ ํด์ ํ๋ค.
git rm --cached filename
3. ๋ค์ ํ์ผ๋ค์ add, commit ํ์ฌ push ํด์ค๋ค.
git add .
git commit -m ".gitignore is now working"
git push origin main
4. ๊นํ๋ธ ์ ์ฅ์๋ฅผ ํ์ธํด๋ณด๋ฉด .envํ์ผ๋ค์ด ์ญ์ ๋ ๊ฒ์ ํ์ธํ ์ ์๋ค.
<์ฐธ๊ณ ๋ ํผ๋ฐ์ค>
https://stackoverflow.com/questions/30696930/how-to-hide-env-file-from-github
How to hide .env file from Github
I'm using dotenv for my rails project to store API keys. I have the dotenv gem in my gemfile, created a .env in the root of my app and have my API keys listed in there. However, when I push up to g...
stackoverflow.com
Ignore files that have already been committed to a Git repository
I have an already initialized Git repository that I added a .gitignore file to. How can I refresh the file index so the files I want ignored get ignored?
stackoverflow.com