DEV Community

Kim Hallberg
Kim Hallberg

Posted on

Create a GitHub profile README using GitHub CLI

While GitHub profiles are the new hot thing it's not the only new thing GitHub has done as of late, so why don't we use the other thing they've released to create our new GitHub profile README, I'm of course talking about the new GitHub CLI tool GH.

Lets create a GitHub profile README using GH! 🎉


What is GH? GH is GitHub's new command-line tool, and while it's currently in beta don't let that fool you, it's powerful - letting you create forks, open pull requests, list, and close issues and so much more, you can see the full power on their documentation.

While I won't go over the installation here, GitHub has provided an impressive list of installation options on their documentation.


Creating a repo using the GitHub command line tool

So, let's jump into it, the first thing we need to do is run the following command gh repo create, we will pass in two flags, the first flag is -d which is the shorthand for --description to give our new repository a nice description and the --public flag, indicating that our new repository will be public.

In the current version v0.11.1, you will get a prompt asking if you want a local version of your repository.


GitHub command-line tool creating repo after answering yes on prompt

After accepting the prompt, your remote and local repository will have been created.


Travel into the newly created folder and write your read me file

We will now cd into our newly created folder and cat some text into a README.md file, after that we will run ls to see if the file was created successfully.


Using git status to check the git workspace

Using our trusty git status we will check the status of our new README.md


Use git add to stage the file to your git workspace

Running git add README.md we will stage our README.md file to our local staging area.


Use git commit to commit your read me to your local workspace

We will now run git commit with a nice message about our changes, in this case, we created a file.


Use git push to push your workspace to your newly created GitHub repo

With all our work done, now we only need to git push our local version to our remote origin and we are done.


You will now have your very own GitHub profile README, created using only the command line. 👍

Challenge time. 🔥

To give yourself a challenge, why don't you create a new branch locally for your next changes and create a pull request for it using gh? 😎

Top comments (0)