添加到全局 git 文件后的文件仍然可见

File after adding to global git file is still visible

继续我之前的问题

我有一个文件,我想将它添加到全局 .gitignore 中,它不应该在项目的 .gitignore 中。

我已将 excludesfile 路径添加到我的 .gitconfig 文件中

[user]
    name = Hesam
    email = MY-EMAIL-ADDRESS
[color]
    ui = true
    diff = true
[core]
    excludesfile = /Users/admin/.gitignore_global

然后我在 .gitignore_global 文件中添加了我不想跟踪的文件的完整路径。

/Users/admin/Desktop/android/my-app/crashlytics.properties

不过,当我导航到我的项目目录并输入 git status 时,我的回复是:

>> git status
On branch fix_confirm_booking
Untracked files:
  (use "git add <file>..." to include in what will be committed)

    my-app/crashlytics.properties

nothing added to commit but untracked files present (use "git add" to track)

如有任何建议,我们将不胜感激。谢谢。

我刚刚弄明白了。不幸的是 Git 不依赖于 full/complete 路径。一旦我用相对(实际上不是相对)路径替换了我的完整路径,它就起作用了。

我做了什么,我从以下位置替换了我的 .gitignore_global 内容:

/Users/admin/Desktop/android/my-app/crashlytics.properties

my-app/crashlytics.properties