title: How to use Git correctly in Android Studio?
body: <p>I know this is a much-discussed topic on stackoverflow, but I just can't figure out how to make this work. I would like to:</p>
  
  <ol>
  <li>create an Android Studio project</li>
  <li>check the project in with git</li>
  <li>push the project to bitbucket</li>
  <li>pull the project on a different computer</li>
  </ol>
  
  <p>This is the .gitignore I'm using (basically the Android Studio created one, where I removed the *.iml files - cause that didn't work)</p>
  
  <pre><code>.gradle
  /local.properties
  /.idea/workspace.xml
  /.idea/libraries
  .DS_Store
  /build
  /captures
  </code></pre>
  
  <p>But somehow, it just won't work. Android Studio won't recognise the Project, no matter what my gitignore file looks like.</p>
  
  <p>So actual question: how do I push an Android Studio project to git so I can simply pull it into another client to continue working?</p>
  
  <p>EDIT:</p>
  
  <p>So here’s how I do things, step-by-step:</p>
  
  <ol>
  <li>create project GitTest in Android Studio</li>
  <li>create a git repository on Bitbucket</li>
  <li>in Android Studio: select “enable version control integration” - pick “git”</li>
  <li>browse to the gitignore files and change it to match Mauker’s</li>
  <li><p>under “project on the left” select “Project” then under Git “Add”</p>
  
  <p><a href="https://i.stack.imgur.com/zGW3i.png" rel="noreferrer"><img src="https://i.stack.imgur.com/zGW3i.png" alt="(screenshot)"></a></p></li>
  <li><p>commit/push the changes (define the remote repo in the process)</p></li>
  </ol>
  
  <p>at this point, the project is on bitbucket. Next comes the "import project" part:</p>
  
  <ol>
  <li>open android studio</li>
  <li>select “Check out project from Version Control”</li>
  <li>Import Project from Gradle (using the default grade wrapper as recommended)</li>
  <li>Unregistered VCS root detected -> add root</li>
  </ol>
  
  <p>The project loads, I get some sort of NullPointerException</p>
  
  <p><a href="https://i.stack.imgur.com/oGt1L.png" rel="noreferrer"><img src="https://i.stack.imgur.com/oGt1L.png" alt="(screenshot)"></a></p>