Push your Project to Github using GIT

Push your Project to Github using GIT

Stuck while pushing the project to github with Git? Don't worry. Let's learn about it!

Β·

3 min read

Git and GitHub are not the same thing.
Git is an open-source, version control tool created by developers working on the Linux operating system in 2005; GitHub is a United States-based global company that provides hosting for software development version control using Git.
So that's a short overview of the software. Let's move on to the process of pushing the project.

For the same I have uploaded a video on YouTube for more better understanding .

πŸ“Œ Requirements

  • You will need a Github account where you will push your projects.

  • Quickly signup to Github.

  • And ofcourse you will need Git through which you will push the projects.

  • If you don't have Git then simply download from here and install it.

πŸ”° Now lets start with first creating a Github repository

Follow this to create a repository:

g1f.png

g2f.png

So our new repository has been created i.e "demo-repo".

πŸ”° Now lets talk about Git

  1. Go to that Project folder which you want to push to Github
  • Here weather-app-py is my project folder. Then right click and you will see option as "Git bash here" click on that option.

b1.PNG

  1. Now our Gitbash terminal is opend.
  • ls is a command which will show all the files or folder in current directory. It will give you an idea that these are the files which will be going to github.

    b2.PNG

  1. Initialize the git repository
  • git init : This command creates a new repository or directory consisting of files with a hidden directory. A file called '.git' is created at the top level of a project, which keeps all revision information in one place.

b3.PNG

  1. git status
  • Use git status in your bash to view all the files which are going to be staged to the first commit. Currently they are untracked. As they are marked in Red.

b4.PNG

  1. Adding files to the new local repository
  • git add : The git add command adds a file to the Git staging area.

  • git add . : used to add ALL the files to Git staging area . We will use this only because we will be adding all the files.

  • git add 'specific_file_or_folder_name : If you want to add a specific files only then use this command.

b5.PNG

After that if you use git status you will see all the files are turned in Green i.e this files are going to be staged.

  1. Then commit the staged files by writing a commit message for your local repository
  • git commit -m 'your message' : You can create a commit message by adding this command which adds the change to the local repository.

  • git commit uses '-m' as a flag for a message to set the commits with the content where the full description is included, and a message is written in an imperative sentence up to 50 characters long and defining "what was changed", and "why was the change made".

b6.PNG

  1. From GitHub, copy your remote repository's URL.

b7.PNG

  1. The URL copied is the remote repository to which your local content is pushed from your repository.
  • git remote add origin 'paste_the_copied_url' : β€œremote” here refers to another system which has the same repository and the 'origin' is the remote name, and the remote URL is "github.com/TanCodes/demo-repo.git".

b8.PNG

  1. Finally, Push the code from your local repository to GitHub
  • git push origin master : So this command establishes a connection with a remote repository and upload your source code or files to GitHub

b9.PNG

  1. Refresh your Github and voila, we've pushed our project successfully.

b10.PNG

Find me around the web 🌎:

forthebadge

forthebadge

forthebadge

forthebadge

forthebadge

forthebadge

[

forthebadge

](youtube.com/channel/UC370GTtJnvWs8wDH9UXoBz.." target="blank)

Β