How to use GH CLI to create private repo in claremont-computer-network org and push code

To create a private repository in a GitHub organization and push your code using the GitHub CLI (gh), run the gh repo create claremont-computer-network/<repo-name> --private --source=. --push command directly from your local project folder.

Step-by-Step Instructions

1. Authenticate with GitHub CLI

Before running commands, ensure you are logged into your GitHub account with the correct permissions.

gh auth login

Follow the prompts to log in via your browser or an auth token.

2. Navigate and Initialize Your Local Project

Open your terminal, navigate to your local code folder, and initialize it as a Git repository if you have not already done so.

cd /path/to/your/local/project
git init
git add .
git commit -m "Initial commit"

3. Create the Remote Repo and Push Code

Run the following single command. Replace <repo-name> with your desired repository name.

gh repo create claremont-computer-network/<repo-name> --private --source=. --push

What This Command Does

Would you like to learn how to add collaborators to this new private repository using the CLI, or do you need help setting up a template for your project files?