A Journal Through My Activities, Thoughts, and Notes
The GitHub CLI (gh) does indeed have functionality to create a remote repository from a local Git repository and push to it. This is accomplished using the gh repo create command.
The specific command that would accomplish what you're asking about is:
Breaking down this command:
-
-
-
-
-
-
Or more simply, you can omit the name parameter. This will use your current directory name as the remote repository name by default.
#github #gh
The specific command that would accomplish what you're asking about is:
gh repo create <repository-name> --public|private --source=. --push
Breaking down this command:
-
gh repo create
is the base command to create a GitHub repository-
<repository-name>
is the name you want to give your GitHub repository-
--public
specifies the newly created repo is public-
--private
specifies the newly created repo is private-
--source=.
specifies that the current directory is the source (local Git repository)-
--push
automatically pushes the local repository contents to the new GitHub repositoryOr more simply, you can omit the name parameter. This will use your current directory name as the remote repository name by default.
#github #gh