36. How to Push to GitHub

This lesson deals with pushing your coding work to GitHub.

What is Git?

Atlassian has a good definition for it:

Git is a mature, actively maintained open source revision control system used by thousands of developers around the world.open-source

What is GitHub?

GitHub is an online version of Git that allows you to not only store your code but also track all the changes you have made to it. Multiple people or teams can work across the code, and everyone can see what’s going on.

It’s a Microsoft company, and you can check it out and start an account for free here: github.com

Let’s start!

I am using VS Code to do my coding work. So, I am using its built-in Terminal to push my changes to Github.

git init
git status
git add . 
git status
git commit -m "Initial Commit"

The “initial commit” is a general comment. You can add what you like here but make it understandable for all.

GitHub gives you all the instructions on the next screen that you need to complete after creating your repository. I will cover them below as well. The first step here is to copy the SSH link.

git remote add origin git@github.com:emanoj1/python-crash-course.git

Remember: This is my file 🙂 Replace the URL after “origin” with your own!

git branch -M main
git push -u origin main
git add .
git commit -m "your comment"
git push

That’s it. I hope this has helped!

Leave a Reply

Your email address will not be published. Required fields are marked *