AlvaroSantisteban
AlvaroSantisteban

Reputation: 5336

Change default gitignore file when creating a new project

Is there a way to change the default file .gitignore that Android Studio creates when creating a new android project? I searched for it in the Settings but could not find anything.

Upvotes: 8

Views: 751

Answers (3)

Mahi
Mahi

Reputation: 492

On Mac, Applications->Android Studio.app(right click -> show package contents) -> contents-> plugins\android\lib\templates\gradle-projects\NewAndroidProject\root\ , i tried modifying, project_ignore file. i dont see error every time while looking for updates. instead of replacing, i appended at the end.

Upvotes: 0

NaCl
NaCl

Reputation: 2713

Unfortunately, there is no way to do that automatically, besides the one Ted has mentioned. However, personally, I don't see this as a big downside, because you can thus safely add your specific templates that fit best to your project. To be able to do this, do the following:

Go to File -> Settings and from there highlight Plugins. Click on Browse repositories... and you should be able to find the plugin entitled .ignore. Install it.

Now to configure a .gitignore for any project, in case you have no project opened, click on Configure -> Settings. In case you have an open project, go to File -> Other Settings -> Default Settings…. Now expand Version Control and click on Ignore Files Support. You should be able to add a custom user template of your .gitignore-file there.

To use any template you've added there, just right click on your .gitignore and click on Add template…. There you'll be able to add your custom specifications, however, many others are given by default, so you don't need to do a google search for an OS or language specific .gitignore configuration.

Upvotes: 3

Ted Hopp
Ted Hopp

Reputation: 234795

Good question. I tried manually modifying the project_ignore template in the Android Studio installation (located at C:\Program Files\Android\Android Studio\plugins\android\lib\templates\gradle-projects\NewAndroidProject\root in my Windows installation). That works, but it causes any future updates to Android Studio to fail unless you restore the original template first.

I'm posting this as an answer because it works. But it has such a bad down-side that I'm also starting a bounty in the hopes that someone can come up with a better solution.

Upvotes: 1

Related Questions