File after adding to global git file is still visible

孤者浪人 提交于 2019-12-12 03:26:12

问题


continue from my previous question Is it possible to ask GIT, don't show a file?

I have a file that I want to add it to global .gitignore that shouldn't be inside .gitignore of project.

I have added excludesfile path into my .gitconfig file

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

Then I added full path to the file that I don't want to track it in .gitignore_global file.

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

Still, when I navigate to my project directory and enter git status my response is:

>> 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)

Any suggestion would be appreciated. Thanks.


回答1:


I just figured it out. Unfortunately Git doesn't rely on full/complete path. As soon as I replaced my full path with relative (actually is not relative) path then it worked.

What I did, I replaced my .gitignore_global contents from:

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

to

my-app/crashlytics.properties



来源:https://stackoverflow.com/questions/28188740/file-after-adding-to-global-git-file-is-still-visible

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!