33.14 Git Create Repository


Git services provide browser based interfaces to create new repositories and to initialise those repositories. To create a new repository under your account on GitHub the GitHub Command Line Tool can be used. This provides the gh command for the task:

$ gh repo create kayon/pygym --public --description "The Python Gym"
Notice: authentication required
Press Enter to open github.com in your browser...
Authentication complete. Press Enter to continue...

Created repository kayon/pygym on GitHub
Create a local project directory for kayon/pygym? Yes
Initialized empty Git repository in /home/kayon/pygym/.git/
Initialized repository in './pygym/'

$ cd pygym
$ echo "# pygym" >> README.md
$ git add README.md
$ git commit -m "Initial import"
$ git push --set-upstream origin main

The sh command will prompt for a username and password. This fails for me perhaps due to two factor authentication.

Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0