How to Push a Project to GitHub in 2 Steps
Advertisements
Have you ever heard of GitHub? It’s a leading collaboration platform in the software development world, boasting over 100 million users as of 2024. GitHub provides hosting services for software development projects using the Git version control system.
GitHub‘s main feature is its ability to efficiently store, manage, and share source code. For any software developer, one of the most fundamental skills to master is “pushing” a project to GitHub.
This tutorial will walk you through the steps to push a project to GitHub and explain the core concepts behind the process.
Advertisements
Core Concepts of Git and GitHub
Before we dive into the steps, it’s helpful to understand the difference between Git and GitHub.
Git is a distributed version control system that allows developers to track changes in their source code locally.
In contrast, GitHub is a cloud-based service that hosts Git repositories online, making it easy to collaborate and share code with a team or the community.
How to Push a Project to GitHub
Here are the step-by-step instructions for pushing a project from your local computer to GitHub.
Advertisements
Prerequisites
Before you can push your project to GitHub, you need to meet two prerequisites:
- Git Installed: Make sure Git is installed on your computer. You can check by running the command git –version in your terminal.
- GitHub Account: You must have an account on GitHub. Read on how to create GitHub account.
Step 1: Create a New Repository on GitHub
- Log in to your GitHub account.
- Click Create Repository to start a new repository.
- Fill in the repository details:
Repository name: Your project’s name (e.g., git-practice).
Description (Optional): A brief explanation of your project.
Choose Public or Private. - Important: If you already have a project folder on your local machine, do not check the options to “Initialize this repository with a README,” “.gitignore,” or “license.” This is crucial to avoid conflicts.
- Click Create repository. After it’s created, you’ll be redirected to a page with several commands. We will use the URL from this page. GitHub repository commands page
Advertisements
Step 2: Connect Your Local Project to GitHub
Open your terminal or command prompt and navigate to your project folder on your computer.
Then, follow the commands below in order:
1. Initialize Git
If your project folder isn’t already a Git repository, run this command. If you already have a .git folder, you can skip this step.
2. Add files to the Staging Area
The staging area is a list of changes ready to be included in your next commit. Use the git add . command to add all files and prepare them for commit:
3. Lakukan Commit Pertama
Also Read:
A commit is a snapshot or record of the changes you’ve made. Your commit message should be short yet clearly describe the changes. Use the git commit -m “initial commit” command to make your commit.
In this tutorial, the commit was made after changing an H1 tag.
4. Connect the Local Repository with the Remote on GitHub
Replace YOUR_REPOSITORY_URL with the HTTPS or SSH URL you copied from your GitHub repository page:
5. Push code to GitHub
This is the final step to send all your committed files to the GitHub repository. The git push -u origin main command will send all commits in the main branch to your GitHub repository.
6. Verification
Once the push is complete, open your repository on GitHub in your browser. All the files and folders you pushed should now be visible.
Advertisements
Technical Explanation of Each Step
Here’s a technical breakdown of each command used to push a project to GitHub:
- Initialization (git init): This command transforms a regular folder into a local Git repository. All changes to files within this folder will now be tracked by Git, enabling rollbacks, branching, and collaboration.
- Staging (git add): The staging area is a temporary location where changes are held before they are officially recorded in a commit. It allows you to select which specific files you want to include in the next commit.
- Commit (git commit): Committing is the process of saving a snapshot of your changes to the project’s history. Each commit has a unique hash, making it easy to track changes over time.
- Remote (git remote add origin): A remote is an online repository (like the one on GitHub) that is linked to your local repository. By connecting to GitHub, developers can easily share their code.
- Push (git push): Pushing is the process of sending commits from your local repository to a remote repository (GitHub). This facilitates collaboration and serves as an online backup for your code.
Advertisements
Successfully Pushed Your Project to GitHub?
That’s the complete tutorial on how to push a project to GitHub, with command examples included. GitHub allows you to work more efficiently, manage project resources, track changes, and collaborate with your team.
As a web development agency, Tonjoo also uses GitHub to develop client websites. This tool enables our team to work more efficiently while maintaining high product quality.
The Tonjoo team has the expertise and experience to bring your business website to life. Hundreds of clients, including Polygon Bikes, Gadjah Mada University, Sunpride, and many others, have trusted us with their projects.
For more articles on WordPress, WooCommerce, and web development, check out Tonjoo Studio Blog by Moch. Nasikhun Amin.
Last Updated on November 28, 2025 by Moch. Nasikhun Amin
Advertisements









