Adding a new Spring Maven Project from Eclipse to Git Repo (Bitbucket)

In the last tutorial we learned about how can we create a new Spring Maven Project in Eclipse / STS ( http://wp.me/p58s9B-3 ) . In this tutorial we will learn how can we add our existing project to a Git repository.

Converting a project into a Git helps you maintain’s version of the changes, also extremely useful when there is a team working on the project.

Steps.

1. To add your project into a git repository , first you have to convert your local repository into a Git repository. Open your command line and navigate to the root folder of your project. and type command git init ( you need to have git installed on your system for this command to work)

2014-11-29 04_23_44-Edit Post ‹ 5 Balloons — WordPress

2. Now you have converted your project into a git project and there is a git repository in your local machine which is currently empty. We’ll commit all the initial files to that repository by running following commands

git add .  ( Add all files)

git commit -m “commit message”

2014-11-29 04_32_09-Administrator_ C__Windows_system32_cmd.exe

3. We need to have a remote repository where we will push all our local repo commits , so that other users can setup the project on their machine from their machine. I have chose bitbucket.org to store my git repo. Login to bitbucket and Create a new blank git repo.

2014-11-29 09_59_19-Create a repository — Bitbucket

4. So we are now ready with local git repo with all our project file and a remote  empty git repo. We need to tell our local git repo where the remote repository is and after that we will push all the files to the remote repo. By issuing following commands

git remote add origin https://your.remote.git.url.git

git push -u origin -all

2014-11-29 04_33_52-Git - http___localhost_8080_2015cricketcup_ - Spring Tool Suite

That is all. Your project in Eclipse will now the branch of remote your project will refer to.

2014-11-29 04_34_22-Git - http___localhost_8080_2015cricketcup_ - Spring Tool Suite

Web Stuff Enthusiast.

Related Posts

1 comments On Adding a new Spring Maven Project from Eclipse to Git Repo (Bitbucket)

Leave a reply:

Your email address will not be published.

Site Footer