Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
234 views
in Technique[技术] by (71.8m points)

gitignore - File after adding to global git file is still visible

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

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

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...