GitHub is a web-based service that uses the Git revision control system to manage sourcecodes.
In the tutorial, JavaSampleApproach will guide you through the steps of configuring GitHub repository with SpringToolSuite for development.
Step to do:
– Register GitHub account
– Create a GitHubRepository
– Configure GitHub for SpringToolSuite
– Create & Share a project to GitHub
1. Setup GitHub account
Go to https://github.com/, then SignUp:
Press the button Sign up for GitHub, we go to next panel: Welcome to GitHub
Here having 2 options for choosing:
– Unlimited public repositories for free
– Unlimited private repositories ($7/month)
For starting, you should choose the first option.
We go to next panel: Tailor your experience.
In here, you have some checkboxes to describes about you. Then press Submit.
Right now, a GitHub message will be sent to your mail account to verify the register.
Click to the link: Verify email address for done the registration.
2. Create a GitHub repository
Now go to Create a new repository page by following the link: github.com/new
Fill info about: Repository name, Description (option).
We have 2 mode for choosing: Public & Private
– Public: Anyone can see this repository. You choose who can commit.
– Private: You choose who can see and commit to this repository. But having money for the mode ()
For starting, we choose Public mode.
Check a option: Initialize this repository with a README.
Press Create repository button. JavaSampleApproach/tutorials is created successfully.
3. Configure GitHub for SpringToolSuite
Open SpringToolSuite, go to: Window-> Show view -> Others -> Git Repositories.
Choose Clone URI. Then fill data: uri – username/password
Note: we got URI at the Clone or download button of the tutorial repository as below image:
Press Next, go to Branch Selection, choose master,
Press Next, go to Local Destination Configuration, edit Directory, then press Finish:
Now, We have finished the GitHub setup for SpringToolSuite.
4. Create a project & Commit to GitHub
Create a simple SpringStartProject: GitHubHelloworld.
Right click on the project, go to Team->Share, fill needed info about GitHub repository:
Press Finish button, the result as below image:
4.2 Commit Sourcecode
Go to the project’s folder, modify .gitignore file:
Replace the old content of .gitignore file with the new content:
Add to Index: right click on the project, go to Team -> Add to Index.
Commit: right click on the project, go to -> Commit
Press Commit & Push, then provides authentication info:
The result after done:
Problems: we need deleted files: .mvn/wrapper and mvnw,
=> How to do it?
Just open .gitignore file, change content of the file to:
Then delete the files from project: .mvn/wrapper/ & mvnw, mvnw.cmd. Righ click on the project, go to Team -> Add to Index.
Righ click on the project, go to Team -> Commit. Add comment:
modify .gitignore file & remove .jar & mvn* file
Now press Commit & Push, see the results: