How to Push Anything to GitHub using Git Bash?
Last Updated :
04 Jun, 2024
GitHub has become the go-to platform for collaborative software development, offering powerful tools for version control, collaboration, and project management. Git Bash, a command-line interface for Git on Windows, provides a quick way to interact with GitHub repositories. In this guide, we’ll learn about the process of pushing anything to GitHub using Git Bash.
Prerequisites
- Must have a GitHub account and git bash installed.
Steps to Push on GitHub using Git Bash
Step 1: Make a GitHub repository by clicking on the ânewâ Button.

Â
Step 2: Now after clicking on that, you will see a screen something like as show below in the image.

Â
Step 3: Give the name of your repository and give a short description of your repository.

Â
Step 4: After that just click on the âcreate repository â option.

Â
Step 5: After that, your repository has been created successfully.

Â
Step 6: Now go to the local folder that you want to push on GitHub and after a right click a menu will show in which you have to click on âGit bash hereâ.

Â
After that GitBash will open and now you have to make a clone of the repository that we have just made. We can make the clone by simply writing the command âgit clone https://linkâ. This https link we will get from our repository.
How to get this https:// link??
Just go to your repository and there is an option name âCodeâ just click on that and how you are able to see the https:// link so just copy that.

Â
Now we are having the link to go back to the GitBash terminal and type âgit clone https://linkâ and hit enter.

Â
Now go to that local folder and you will find a new folder that is the same as our repo name.

Â
Now Just copy these files and paste them inside this demo_repository folder.

Â
Just go to your GitBash terminal and write âlsâ and hit enter this command will show all the files that are present inside that folder.

Â
Now we have to go inside this Demo_repository folder so this we can write âcd folder nameâ.

Â
Now again we can write the ‘ls’ command to see what is inside the folder.

Â
There is a command âgit statusâ this shows the status. Whatever the changes we made in this folder and after that we execute this command then this will show us all the changes in red color.

Â
So to add these changes we will write the command âgit add -Aâ by this whatever the changes we have made at once added to the stitched area means now if we run the git status command all files are shown in green color.

Â
Now it is time to commit these changes we can do this by the command âgit commit -m âa valid message ââ.

Â
If we run the git status command it will show something like.

Â
This is the last step now write the command âgit push origin mainâ and hit enter.

Â
Now go to your repository and there you will find all the files that you have pushed.