Push a Local Repository to GitHub

In this blog post, I will show you how to push a local repository to GitHub from a Linux machine.

I will break down the process to two. First, I will create a repository on my machine.

After creating it on my machine, I will create another one on Github with the same name.

The final step will be pushing the local repository to GitHub.

Local Machine

On my Linux machine, I will create a repository using the commands below.

mkdir 3.Repo
cd 3.Repo/
git init
touch run.ps1
git add .
git commit -m "first repo"

The name of the repo is 3.Repo.

Create a new repository on GitHub

I will move on to the GitHub website and create a new repository with the same name.

 I will make it private and will leave the settings as shown below.

After clicking Create, I will note down the repository URL.

Push Repository

In the final step, I will add the repository URL to the following command and push it.

git remote add origin https://github.com/urlofrepo.git
git push -u origin master

You can see the final results below.

Success! You're on the list.