How do I add an existing IntelliJ Java project to git?

Neeraj Jain :

This question is similar to this one for Eclipse but with a different IDE.

How can I add my pre-existing Java to git in IntelliJ IDEA?

Current State:

  • Existing Spring Boot Project initialized from start.spring.io
  • Newly created GitHub repository

I could check out the new repository, copy the contents of my project to this directory and just push to master, but is there a simpler way within the IDE that avoids changing the location of the project?

Vinz243 :
  1. Go to VCS > Import into Version Control > Create Git Repository
  2. Then go to VCS > Git > Remotes
  3. Click the + button, leave origin as-is and paste the Git URL of your repository
  4. VCS > Git > Git Pull then VCS > Git > Git Push

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=72285&siteId=1
Recommended