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 are familiar with and go to your project location, which you wanted to push into GIT.
Step 2:
I have created a simple Spring-Helloworld project, and I would like to push this into my GIT account.
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 see the below .git/
hidden folder.
Step 4:
Check the status of the project by hitting the git status
command.
There you can see the branch details and untracked files in red colour. These files are uncommitted files; if you want to commit these files, first, you should add these files to GIT by hitting the 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.
After adding the files to git, check the git status again to confirm the things.
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.
Check the status for this; you could see nothing to commit message for your git status.
Now it’s time to push these changes to your git repository.
Step 7:
Login to your git account and create a GIT repository like below.
Click on New repository option to create a repository.
Step 8:
Give the name to your repository and click on create repository button.
Step 9:
This is how you are repository looks like.
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.
You can get the remote repository URL from the above Clone or download the 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.
Step 12:
Now push the project into GIT repository using git push
command.
Step 13:
Validate the things in the remote repository, just refresh your git repository then you could see your project.
Done!
References:
Happy Learning 🙂