A step-by-step guide to pushing your project to GitHub using GitHub CLI

Pascal ObalaPascal Obala
2 min read

GitHub CLI is a tool that enables you to use GitHub functionality alongside Git commands without having to leave the command-line interface. To use it you would first have to install it from the official website- https://cli.github.com/. Once you have it installed I will guide you through the process of creating a repository and pushing your project to github straight from the terminal.

1. Initialize a Git Repository (If not already done)

First, ensure you're in your project directory. In my case it would be (expo-user-management). Run the following command to initialize a git repository if you haven't already:

git init

2. Commit Your Changes

Make sure all your changes are committed:

git add .
git commit -m "Initial commit"

3. Create a New Repository on GitHub

To create a new repository directly from your terminal using GitHub CLI:

gh repo create expo-user-management --public --source=. --remote=origin

4. Push Your Local Repository to GitHub

Once the repository is created, push your code to the new GitHub repository:

git push -u origin master

5. Verify Your Repo on GitHub

Once the push is complete, you can check your repository on GitHub by running:

gh repo view --web

This will open your repository in your default web browser.

0
Subscribe to my newsletter

Read articles from Pascal Obala directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Pascal Obala
Pascal Obala