2

I'm starting to use Android Studio as a git client for my projects. But I cannot find where I can set global .gitignore file for filtering files on any project by default. The same is done in SourceTree in tools-options-git-global_gitignore_list.

DmitryBorodin
  • 4,584
  • 4
  • 17
  • 29
  • What do you mean by global gitignore? Like that http://stackoverflow.com/questions/7335420/global-git-ignore ? Dont start using AS as git client ;) Use console if u dont have habbits yet. It's easier, safer and more reliable. – Nickname0222022022 Aug 18 '16 at 09:05
  • Merge files via command line? No, thx -) I mean I have a file, how to tell android studio to use this file as gitignore rules in every project? – DmitryBorodin Aug 18 '16 at 09:22
  • You're better off to add a similar `.gitignore` file to every project, so that people who pull it aren't missing the ignores that you have configured globally on your machine. – vikingsteve Aug 18 '16 at 10:22
  • I know, every project have it's gitignore files. But I have my own as well, and i use it in addition to project's ignore file. I think it's common practice. – DmitryBorodin Aug 18 '16 at 15:55

1 Answers1

2

Create a file listing your git ignore patterns and configure it as the global excludesfile. For example, if you're on a Unix-like system and have a .gitignore file in your home directory, you would run:

git config --global core.excludesfile '~/.gitignore'

Android Studio should pick it up automatically (although you may have to restart it). Make sure the git client on your command line is the same as the one AS is configured to use.

tro
  • 524
  • 4
  • 12