When I started actively pushing content to Github, I did not push Open Source contributions, Components or anything of the like - I pushed poetry. I did this, because it is what I love the most, after coding. I remain ever grateful that I took the initiative to make my first git commit.

Now, I want to breakdown the process for new coders (and poets - hopefully ), so that they can become comfortable with working with Github too. I will be breaking down several ways to push content to Github. For the purpose of this article, I will assume that readers are familiar with Terminal usage (GitBash or otherwise).


Pushing to a new repository with a README file

There are just a few essential steps to this:

  • Click the green Clone or download button on the repository page.
    Git Clone
  • Use the Clone with HTTPS option, and copy the link provided.
    Git Clone 2
  • Run git clone https://github.com/UserProfile/repository.git in the terminal. Here, UserProfile and repository will be replaced by the values provided in the copied link.
  • Run git init in the terminal. This will initialize the folder/repository that you have on your local computer system.
  • Run git add . in the terminal. This will track any changes made to the folder on your system, since the last commit. If this is the first time you are committing the contents of the folder, it will add everything.
  • Run git commit -m"insert Message here". This will prepare the added/tracked changes to the folder on your system for pushing to Github. Here, insert Message here can be replaced with any relevant commit message of your choice.
  • Run git push origin master. Note that the last word in the command master, is not a fixed entry when running git push. It can be replaced with any relevant “branch_name”.

How to push Existing Code to a new Github repository

"Coding is a beautiful thing. Anyone can learn to code!"

What you need to do:

  • Copy the HTTPS link provided.
    Example Empty Repo
  • Run git init in the terminal. This will initialize the folder/repository that you have on your local computer system.
  • Run git add . in the terminal. This will track any changes made to the folder on your system, since the last commit. As this is the first time you are committing the contents of the folder, it will add everything.
  • Run git commit -m"insert Message here". This will prepare the added/tracked changes to the folder on your system for pushing to Github. Here, insert Message here can be replaced with any relevant commit message of your choice.
  • Run git remote add origin https://github.com/Usheninte/example.git in the terminal. Here, Usheninte and example will be replaced by the values provided in the copied link. This will push the existing folder on you local computer system, to the newly created Github repository.
  • Run git remote -v. This does some git pull and git push magic, to ensure that the contents of your new Github repository, and the folder on you local system are the same.
  • Run git push origin master. Note that the last word in the command master, is not a fixed entry when running git push. It can be replaced with any relevant “branch_name”.

So, that's it! I honestly believe anyone can learn to code. I have spent the past year, tutoring undergraduate students in Nigeria, on Software Development. Soon, I will be starting off my journey as an Entrepreneur-in-Training at the Meltwater Entrepreneurial School of Technology.

Start coding today!