.gitignore com . env

Asked

Viewed 3,444 times

3

I added a . env to my .gitignore. file. But when I change something in . env, the changes are going up together in the commit.

Follow my . gitignore:

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock


# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

.env

I have tried adding directly by the Vscode option, but it did not roll. Does anyone know what can be?

  • Try these commands git clean -n -xf and then git clean -xf.

  • Thanks for the support, but it hasn’t worked yet.

1 answer

8


When the file is in the staging area and you add it to the .gitignore, it is not removed. For this, do:

git rm --cached .env

What this command will do, because of the flag --cached, is to remove the Git index file, but keep it on your system.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.