How to Upload Files to Github Through Terminal

In this video I want to show you how to push you project to github if you don't know anything about git or github at all. If you are just starting and you want to upload somewhere your code or project for you CV for example github is a nice place for this.


Hi I'm Oleksandr Kocherhin from monsterlessons-academy, where I'm teaching you how to become a developer or improve your skills of being a developer in learning by doing way. And if you are new here don't forget to subscribe and I will link everything that I'm mentioning in the description.

So let's get started.


I already told you in my other video about getting your first job and what steps do you need for that. I will link it down in the description. One important point there was that you need to create your own projects so that they replace your lack of real experience and the best way of adding them to your CV is to upload with GIT somewhere. So in this video I want to show you how without any git knowledge you can do it relatively easy.

So first question what is GIT? It's a version control system. The idea is that you can track all your changes in project with GIT and make a snapshot of every state of your code. So you code will never be lost and you can switch easily between different versions of your code.

Now what is Github? It's a most popular service where you can upload you project with Git.

First of all you need to create an account there. Nothing special just register there and confirm your email.

The next step that we want to do is to create a repository. What is repository? It's a place where our project will live. Here we click create new repository and write some name. Let's say that you made a markup of twitter locally and now you want to add it to your CV. So it will be "twitter-markup". The important point here is to choose public repository because we want to make it visible for everybody.

Now we see a page with important information about how to upload your code to this repository. The most important point here is that to choose on top "HTTPS" and not "SSH". This will simplify upload for us.

Now you need to install Git on your machine. You can just go to official website and downloading Git. After Git installation you can use it from Graphical interface and from terminal. I highly recommend you do go for terminal first of all because it's a native way to use git even if it sounds more complicated (but it's actually not). After Git installation you can open any terminal that you have any Git will be available there. For example on Windows you will get Git Bash after installation and it's a nice terminal to work with Git in Windows for example.

Now you need to check that Git is available for you. If you write in terminal git --version and you get some response it means that everything is fine and you are good to go.

Now when you installed everything we need to set your name and email for git. It's won't be used to send email so you can use any email what to want. It will be just visible when you make changes to your code.

To get name and email you need to write in terminal.

$ git config --global "John Doe"
$ git config --global [email protected]

It will simply set in global git configuration your name and email.

Now it's time to start working on your project. Let's create a folder twitter-markup and some file index.html inside. So I'm assuming that you just did the whole project locally and you just want to upload it to github.

Now inside console you need to jump in the folder that you created. You can use cd command for this.

cd ~/projects/tmp/twitter-markup

Now we need to initialize git iniside our project. For this we are writing git init and git will start to track our project.

git init

The next step is to set you remote which means the link to your github repository.

git remote add origin

Now our git know where to upload our changes.

The next step is to add all your files to git tracking. After this command git will track all changes in them.

git add .

dot here means "Just add everything".

Now we need to make a commit. Commit means the snapshot of the current state of all your files.

git commit -m "Created twitter markup project"

Here we wrote git commit with attribute -m to write some commit message. Normally we write what we did in the commit.

As you can see we successfully created our commit and now we just need to push our work from local to github.

git push origin master

This command will push your everything to github. Now if we will reload the page on github you can see all your files there, check them, and so on.

It may look like we did hundreds of magic commands to let's go through them again. Git init initialize git inside your project. Git remote add sets github repository so that your git locally knows where to upload your changes. Then we add all files to git with git add command. The we make a snapshot of the state with git commit and with git push to upload our code to github.

You can just note somewhere all this commands because you will use them every day.

Now let's say we did some changes to your project and you want to update you project on github. It's enough to do

git add .
git commit -m "Added foo"
git push origin master

Just this 3 commands every time. This is all you need. Now you or everybody can see all your commits and switch to any state of your code. You will also never lose your changes and you code is available for you from any machine.

Call to action

So in this video you learned how to upload your project to install git and upload your project to github. How you can simply add the link of your projects to CV and your interviewer will see that you understand at least how you need to work with code and it's easy for him to check your projects.

Also it may look complicated from the beginning to work from console but it pays off in the future when you improve your git knowledge

And actually a have a course about git where I'm teaching you everything that you need to know in everyday work with git. I will link it in the description below as well as my other courses.

If you find this video helpful, don't forget to subscribe to this channel and hit subscribe button. And I see you in my next video.

🚨 Important