Convert existing code project into a git project using Eclipse


If you have a project on your Eclipse, on your local computer that is not version controlled and you realize that you should do it. Well, this is quick and easy!

  • Step 1: Open Your Project in Eclipse
  • Step 2: Right click on your project folder and select: Show in -> Terminal
    Show Eclipse Project in Terminal
  • Step 3: Now in the terminal run the command: git init

    Example:
    $ git init
    Initialized empty Git repository in /Users/code2care/eclipse-ws-bit-bucket/myapp/.git/
  • Step 4: Now you should see that your project has the .git repository (Close your project and re-open if you do not see the repo)
    $ ls -la
    total 16
    drwxr-xr-x@ 8 code2care  staff  256 Jan 11 15:14 .
    drwxr-xr-x@ 4 code2care  staff  128 Jan 11 15:08 ..
    -rw-r--r--@ 1 code2care  staff  386 Jan 11 15:08 .classpath
    drwxr-xr-x@ 9 code2care  staff  288 Jan 11 15:14 .git
    -rw-r--r--@ 1 code2care  staff  364 Jan 11 15:08 .project
    drwxr-xr-x@ 4 code2care  staff  128 Jan 11 15:08 .settings
    drwxr-xr-x@ 3 code2care  staff   96 Jan 11 15:08 bin
    drwxr-xr-x@ 3 code2care  staff   96 Jan 11 15:08 src

Now you can commit your project to your local repository using Right Click on the project: Team -> Commit...

Convert a Local Project into Git Repo using Eclipse

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap