Hi Friend!
Today I wanna share with you how I quickly create new repositories on GitHub just using my Terminal.
If you didn’t know, GitHub has a CLI, that enable you to create and manipulate your repositories. Which make your life easier when you are creating new repositories for your projects, prototypes and POCs. You can Install here.
Once you install the CLI follow the steps below to create a new repository.
01 – First, initialize Git:
git init
02 aSecond, create a new branch called main:
git checkout -b main
03 – Now create a new repository using the gh
command.
gh repo create repo-name --public --source=. --remote=origin
- The flag
--public
make the repository public - The flag
--source
define the path/folder for the repository - The flag
--remote
define origin name for the repository
04 – Once you create the repository, add all files to staged:
git add .
05 – Now create your first commit:
git commit -m "feat: add initial files"
06 – And push all your updates to the main branch:
git push -u origin main
07 – Now to see if it worked it properly, try to access the repository:
gh browse
Great! You did it! You just create a repository via terminal. 😎