Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Is it possible to create a remote github repo 100% locally?

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>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

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading