In this tutorial, we are going to see how to push the project into GIT Repository.

Environment:

  • Windows 10
  • GIT 2.21.0
  • Git Bash

How to push the project into GIT Repository:

Before going to the following steps, make sure that you have install GIT on windows 10 operating system.

Step 1:

Open Git Bash/Windows command prompt whichever you familiar with and goto your project location which you wanted to push into GIT.

How to create a new project in GIT

Step 2:

I have created a simple Spring-Helloworld project, and I would like to push this into my GIT account.

How to create a new project in GIT 2

Step 3:

Initiate git init command to make this project keep track by GIT. As soon as you hit the git init under the project root directory, you would see the below .git/ hidden folder.

How to create a new project in GIT 3

Step 4:

Check the status of the project by hitting the git status command.

How to create a new project in GIT 4

There you can see the branch details and untracked files in red colour. These files are uncommitted files; if you wanted to commit these files, first you should add these files to GIT by hitting git add command.

Step 5:

Git add . command is used to add all the uncommitted files to git, and make them available to commit. If you wanted to add selected files, you could use the git add command with the file name, and it is also valid of using wildcards.

How to create a new project in GIT 5

After adding the files to git, check the git status again to confirm the things.

How to create a new project in GIT 6-min

On the above screen, you can see the added files in green colour. Now, these files can be committed to your git repository.

Step 6:

Commit the changes to git using git commit command. You can also make a simple note message for this specific commit using -m parameter there you can write a note about these changes.

How to create a new project in GIT 6

Check the status for this; you could see nothing to commit message for your git status.

How to create a new project in GIT 8

Now its time to push these changes to your git repository.

Step 7:

Login to your git account and create a GIT repository like below.

How to create a new project in GIT 9

 

Click on New repository option to create a repository.

Step 8:

Give the name to your repository and click on create repository button.

How to create a new project in GIT 10

Step 9:

This is how you are repository looks like.

How to create a new project in GIT 11

Now, this is the time to push our local project to a remote git repository.

Step 10:

To push the project/changes into the remote repository, we need to have the remote repository’s location/URL.

How to create a new project in GIT 12

You can get the remote repository URL from above Clone or download dropdown button.

Step 11:

Add your remote repository by hitting git remote add origin remote address. For the very first time, it may ask your git credentials to connect with it.

So after completion of this step, your project and repository have been linked.

How to create a new project in GIT 13

Step 12:

Now push the project into GIT repository using git push command.

How to create a new project in GIT 14

Step 13:

Validate the things in the remote repository, just refresh your git repository then you could see your project.

How to create a new project in GIT 15

Done!

References:

How to install GIT on windows

Happy Learning 🙂