If you are like me, you don't like to create a GitHub repository on the GitHub website.
That's where the Github CLI comes. Using GitHub CLI we can create a GitHub repository with just a few commands from the command line.
*Before creating a repository using CLI we need to install it. *
You can install Github CLI from this Link.
Using the command line, navigate to the folder you trying to make a repository.
Then using the below command initialize the local directory as a Git repository.
git init -b main
To create a repository on Github we are going to use this command.
Make sure to change the "project-name" with the name you want your repository to be.
gh repo create project-name
Now, Follow the interactive prompts. If you don't like it. you can specify arguments to skip these prompts. For more information about possible arguments, see the GitHub CLI manual.
Pull changes from the new repository that you created.
git pull --set-upstream origin main
Lastly, add files edit files and push them to Github.
git add . && git commit -m "initial commit" && git push
I like this approach of making a Github repo. Cause I get to click less.
If you have any questions please leave a comment. I will be more than happy to talk to you.
And if you like my articles. Follow me on Twitter at @coderamrin
Thanks for READING.
Have a nice day.
Top comments (0)