I am writing a script that needs to create a repo. I would like it to be fully automatically and avoid users (assuming users all have github setup locally) creating a remote repo in github manually. Is it possible I can create a repo using only git CLI from local?
To start with test-folder:
mkdir test-folder; cd test-folder; touch REAMDE.md
git init .
git add .
git commit -m 'initial commit'
# Do not have an existing repo remotely in github.com
# git remote add origin
# git push origin master
>Solution :
The Git CLI itself does not support this, since it has no knowledge about Github or other repository providers.
However, Github offers a CLI tool as well (documentation here: https://github.com/cli/cli), which has a command to create repositories:
gh repo create [<name>] [flags]
Documentation: https://cli.github.com/manual/gh_repo_create