|

How To Create A New GitHub Repository (2026)

To create a new GitHub repository, click the create menu in the upper-right corner of any GitHub page, choose New repository, name it, pick public or private, and click Create repository.

You can also do it from a terminal with the GitHub CLI command gh repo create.

This guide covers both routes, plus how to push code you already have on your computer.

Table of Contents

Quick Answer

MethodCommand or buttonBest for
GitHub websiteCreate menu, New repository, Create repositoryMost people
GitHub CLIgh repo create my-project –public –cloneTerminal users
TemplateUse this template, Create a new repositoryStarting from an existing layout
Existing local projectgit init, commit, remote add, pushCode already on your computer

Create A Repository On The GitHub Website

  1. Sign in to GitHub.
  2. In the upper-right corner of any page, open the create menu and choose New repository.
  3. Pick the Owner: your personal account or an organization.
  4. Enter a repository name and an optional description.
  5. Choose Public or Private visibility.
  6. Optionally add a README, a .gitignore file or a license.
  7. Click Create repository.

GitHub then shows a Quick Setup page with the repository URL and next steps.

Repository Name Rules

A name can be up to 100 characters.

Only ASCII letters, digits, periods, hyphens and underscores are allowed.

Pick something short and memorable, such as hello-world, and avoid spaces.

Public Or Private

VisibilityWho can see it
PublicEveryone on the internet
PrivateYou, people you explicitly share access with, and certain organization members
InternalOnly organizations on GitHub Enterprise Cloud owned by an enterprise account

You are not locked in. People with admin permissions can change an existing repository’s visibility later.

README, .gitignore And License

A README describes your project, and its contents appear on the repository’s front page.

You can add a README, a .gitignore file or a license while creating the repository.

Skip all three if you plan to import or push an existing repository, because they can cause merge conflicts.

The GitHub CLI can also apply a .gitignore template and an open source license when it creates the repository.

Create A Repository With The GitHub CLI

Run gh repo create with no arguments to answer prompts. To skip the prompts, give a name and one visibility flag.

gh repo create my-project --public --clone

That creates a public repository and clones it into the current folder.

FlagWhat it does
–public, –private, –internalSets visibility; one is required for non-interactive use
–cloneClones the new repository locally
–add-readmeAdds a README
–descriptionSets the description
–source=. –pushUses the current folder and pushes your commits

Push An Existing Project To A New Repository

Create the repository on GitHub first, and leave the README, license and .gitignore options off.

  1. Open a terminal in your project folder.
  2. Run git init -b main (Git 2.28.0 or later).
  3. Run git add . to stage your files.
  4. Run git commit -m "First commit".
  5. Run git remote add origin REMOTE-URL, using the URL from the Quick Setup page.
  6. Run git remote -v to verify it.
  7. Run git push -u origin main.

Do not commit passwords or API keys. Once pushed, they can be exposed.

Windows users can confirm their tools first with the guide to checking your PowerShell version in Windows 11.

Make Your First Commit

A new repository is empty until you add something.

The quickest start is to turn on Add README when you create it.

To commit from a terminal after cloning, create or edit a file, then check it with git status.

git add README.md && git commit -m "Add README"
git push --set-upstream origin HEAD

Write a short, meaningful commit message each time.

If you are on the default branch, GitHub recommends making a new branch for your change and then opening a pull request.

Start From A Template

  1. Open the template repository on GitHub.
  2. Click Use this template, then Create a new repository.
  3. Choose the owner, name and visibility.
  4. Select Include all branches only if you want every branch copied.
  5. Click Create repository from template.

A template starts a new project with a single commit, while a fork keeps the full history of the original.

If It Doesn’t Work

  • The name is rejected. Remove spaces and any characters other than letters, digits, periods, hyphens and underscores.
  • You cannot pick an organization. Organization owners can limit who may create repositories.
  • The push fails after adding a README. Create the repository empty, or pull first.
  • The CLI asks for visibility. Add –public or –private.

For editing files on Windows afterward, see how to remap keys with PowerToys if you want shortcuts for coding.

Fill In The Form From A Link

GitHub accepts URL query parameters that prefill the new repository form.

ParameterMeaning
nameRepository name
descriptionRepository description
visibilitypublic or private
ownerA username, an organization, or @me

Invalid parameters are ignored, and you need permission for each one.

FAQ

Can I create one for an organization?

Yes, choose the organization as the Owner, or use ORGANIZATION-NAME/PROJECT-NAME with the CLI.

Can I rename or hide it later?

Admins can change visibility later. Pick a good name from the start.

Should I add a README?

Yes for a new project, since it appears on the front page. Skip it when pushing existing code.

What is a commit?

A snapshot of all the files in your project at a point in time.

Sources: GitHub Docs: Creating a new repository, Adding locally hosted code to GitHub and GitHub CLI manual: gh repo create.

Leave a Reply

Your email address will not be published. Required fields are marked *