DevLog

.envํŒŒ์ผ์„ .gitignore์— ์ž‘์„ฑํ•˜์ง€ ์•Š๊ณ  ๊นƒํ—ˆ๋ธŒ์— pushํ–ˆ์„ ๋•Œ ๋Œ€์ฒ˜๋ฒ• ๋ณธ๋ฌธ

๐Ÿ˜‚ Error-log

.envํŒŒ์ผ์„ .gitignore์— ์ž‘์„ฑํ•˜์ง€ ์•Š๊ณ  ๊นƒํ—ˆ๋ธŒ์— pushํ–ˆ์„ ๋•Œ ๋Œ€์ฒ˜๋ฒ•

Seungjae Lee 2022. 3. 8. 22:18

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

 

https://stackoverflow.com/questions/1139762/ignore-files-that-have-already-been-committed-to-a-git-repository/1139797#1139797

 

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

 

Comments