0

Every time I am starting a new IntelliJ IDEA project I encounter the same problem: I want to link the project to a new git repository (like one that I created on Bitbucket.com). But it always takes ages to figure out how to set this up until I finally manage to do it. And when I start the next project I run into the same problem. So, I wanted to ask if anyone knows the exact steps I need to take to create a new project and link it to a new, empty repository.

Do I first create a new repository, clone it and then generate my project into that folder? I tried that but then Intellij IDEA keeps telling me there were no changes when I am trying to do my initial commit. Also, git status in the command line says there is nothing to commit.

If I create an empty repository and then create a new Project File>New>From existing sources my project is linked to the repository and I can commit. But I can generate a project anymore.

Can anyone summarize the process in a few simple steps? There must be a simple solution to this, but I can't figure it out :(

arne.z
  • 3,242
  • 3
  • 24
  • 46
  • 2
    Learn how to use Git completely from the command line. Then you won't have to worry about using any IDE's Git functionality. – Sumner Evans Nov 20 '16 at 23:35
  • I agree with Sumner. You'll inevitably run into a situation where the IDE's VCS capability limits you - best to stick to command line, or failing that use a standalone Git GUI instead. – scrowler Nov 20 '16 at 23:41
  • I know how to use git from the command line, but it is more convenient to have the git integration in my IDE – arne.z Nov 20 '16 at 23:41

1 Answers1

0

Okay, so for everyone who had the same problem as me. I solved my problem with the help of this answer. Here is how you do it:

  • Create a new repository on GitHub or Bitbucket or ...
  • Create a new project in IntelliJ IDEA/Android Studio
  • Click VCS --> Enable Version Control Integration, select Git
  • In the terminal go to the directory of your project and execute git remote add <remote_name> <remote_url> (Bitbucket gives you the exact command when clicking I have an existing project)
  • Right-click on your project name in the Project window and click Git -> Add.
  • Click the OK button and you linked your project successfully
  • Now, do your first commit: VCS -> Commit Changes
Community
  • 1
  • 1
arne.z
  • 3,242
  • 3
  • 24
  • 46