Link Spring Boot Project to GitHub Repository

Below is a guide to link your Spring Boot Project to the GitHub repository. If you want to create a Spring Application, refer to this blog.

Create a new GitHub repository on GitHub:

new-github-repository

Let’s suppose we are creating an eCommerce website.

  • Click on the “Create repository” button.

  • On the next page, copy the following command:

git remote add origin https://github.com/Siddpawar9222/ecommerce-website.git

add-gitHub-repository

Let’s suppose you created a new Spring Boot project named ecommerce-website.Open this project and open Git Bash or CND in this directory.

ecommerce-website-directory

gitbash-ecommerce-website-directory

Initialize the Git directory using the command: git init

initialize-git-directory

Stage and commit changes using the command:

git add . git commit -m "created ecommerce website project"

stage-commit-changes

Add the GitHub repository by pasting and executing the command we copied in Step 1:

git remote add origin https://github.com/Siddpawar9222/ecommerce-website.git

add-git-repo-github

Push changes to GitHub using the command: git push origin master

push-changes-github

On the GitHub repository, you can see that we have connected the local Git repo to the GitHub repository. The master branch is also created, and all changes are pushed to GitHub.

master-branch-created

Congratulations! You have successfully created a Spring Boot Application and linked it to GitHub.

Watch our YouTube Video to work with GitHub and learn the PR process.