Reputation: 89
I worked on a project and after running git add I noticed a directory which was not intended to be in there. The directory to be removed is .idea/. After running
git config core.excludesfile .idea/
I got a message
fatal: cannot use .idea/ as an exclude file
And now my console has frozen, any git related command except dit diff throws the same error. How could I get my rep functioning normally? Thank you in advance.
Upvotes: 2
Views: 4807
Reputation: 2404
following solution helped me
git config --global core.excludesfile ~/.gitignore
Upvotes: 4
Reputation: 114578
You need to add your directory to the file named by core.excludesfile
, which normally defaults to .gitignore
. The reason git
freezes is that the ignore file gets checked by almost every command, but you have a folder instead of a file specified.
To fix your immediate problem, open .git/config
in a text editor. You should see a section that has the following:
[core]
...
excludesfile = .idea/
(...
represents a bunch of other lines that you don't care about). Remove the line with excludesfile
. That will restore your repo to using .gitignore
as the list of excluded files.
To properly ignore your .idea/
directory, open a file called .gitignore
in your root project directory (make a new one if you have to). Add the following line to it:
.idea/
This will tell git
to ignore any folders named .idea
anywhere in your project. If you only want to ignore it in the root directory, add the following instead:
/.idea/
Since it appears from the question that you already added the file, you will have to remove it from the index as well as from your repo. Make sure to run the following:
git rm --cached .idea
Thanks to @TimBiegeleisen's comment for the last part.
Upvotes: 4