A Weird Error In A Weird Place.
Remove With The --Cached Flag!
git rm --cached .creds.js
Writings about one coder's stories & experiences.
Ah git. Git is powerfully ferocious utility for version control of the code for a software project, but you must tame the beastly demon of experience by coming to sumbling blocks, getting through them, and documenting how you did it. So, let's do it...
A Weird Error In A Weird Place.
So once upon a time I was working on project for a webscraper that actually entered a username and password into the input boxes and hit submit. The username and password were saved in a file that I wanted to have locally but not push to my public github repo. I created a hidden file with the dot in front (although that's not really hiding it rom anyone), .creds.js, and then added `.creds.js` to my .gitignore file. However, I was getting this weird error in the actual project explorer panel of Webstorm.
Then went I went to to `git add -A` in the command line it still added .creds.js! Gad-flippin-zooks, I thought I added it to gitignore! Why will this zombie file not die??!
Remove With The --Cached Flag!
Thanks to the great stack overflow question and answers here I found the correct command.
git rm --cached .creds.js Don't Forget The --Cached, Seriously!
I've looked this up a few times now because I always seem to forget the --cached flag. It's pretty bad too because just running `git rm .creds.js` just gives me the error, "fatal: pathspec '.creds.js' did not match any files.". Not nice!
0 Comments
Your comment will be posted after it is approved.
Leave a Reply. |
AuthorThe posts on this site are written and maintained by Jim Lynch. About Jim...
Categories
All
Archives
March 2023
|