Create Git Repos From the Command Line + Push Your Code in one Command

Using a small extension to the Github CLI called Hub.

because no one cares if you don’t have a picture. credit unsplash.

Three steps and you are off and running.

  1. Download Homebrew for Mac OS
  2. Download Hub for Github
  3. Run the script below (copy and paste into your terminal of choice)

Why

If you are like me, you like to track all your personal projects and files in source control. If you are in a workflow where you need to create new repos frequently it’s kind of a pain to have to keep switching in and out of command line and the git website.

What it does

The script above will take the following steps for you:

  1. Create the local git repo
  2. Create the remote Git Repo
  3. Connect the two repos
  4. Commit your code
  5. Move all your code to the remote branch
  6. Open the browser to your new remote repo, with code inside

The resulting repository:

Thanks for reading!

~ Alex Zito-Wolf

Product Manager + Software Developer. Interested in Travel, Culture, and the Internet.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store