r - .gitignored 文件仍然显示在 RStudio 中

标签 r git rstudio

我将文件夹 .Rproj.user 添加到 .gitignore。但是,其中包含的一些文件仍然显示(见屏幕截图)。有什么想法我可以做些什么吗?

enter image description here

更新

添加.Rproj.user/**后没有变化

enter image description here

最佳答案

首先,您的文件已经提交,因此您必须将其从存储库中删除:

# 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

您需要将其标记为文件夹。
为此,如上所述添加 2 **

enter image description here

附言

这是一个很酷的钩子(Hook),当您尝试将它们推送到服务器时,它会阻止要添加的那种文件。

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

关于r - .gitignored 文件仍然显示在 RStudio 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36185456/

相关文章:

r - R : better to operate on row values or factor levels? 中的数据转换

git - Sourcetree 在全局 .gitignore 中添加文件,而不是在存储库 .gitignore 中

R-Shiny 使用 Reactive renderUI 值

R - 是否可以优化或简化对 grepl() 的多次调用?

r - 使用函数 rle() 时出错

git - 两个相同的 git 存储库

git - 带有Docker构建的PHP和Composer:无法克隆git

r - 将 rCharts 添加到 packrat

r - 从 GraphViz 保存序列树

r - 在 dplyr 中使用 group_by() 与 filter() 类似吗?