Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
226 views
Welcome To Ask or Share your Answers For Others

1 Answer

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...