Mark Heckmann
Mark Heckmann

Reputation: 11441

.gitignored files still shown in RStudio

I added the folder .Rproj.user to .gitignore. However, some files contained in it still show up (see screenshot). Any ideas what can I do about it?

enter image description here

Update

No changes after adding .Rproj.user/**

enter image description here

Upvotes: 22

Views: 6995

Answers (1)

CodeWizard
CodeWizard

Reputation: 142542

First of all your files are already committed so you have to remove it from the repo:

# Once you add files to git, it will keep tracking them,  
# so we have to delete them and commit your deletion
git rm -r --cached .Rproj.user/**

# Commit the deleted files
git commit -m "Removed files...."

# now add it to the `.gitignore` and the files will be ignored
echo '.Rproj.user/**' > .gitignore

You need to mark it as folder.
In order to do so add the 2 ** as described above

enter image description here

P.S.

Here is a cool hook which will block that kind of files to be added when you try to push them to the server.

What are some more forceful ways than a .gitignore to keep (force) files out of a repo?

Upvotes: 42

Related Questions