hub is an extension to command-line git that helps you do everyday GitHub tasks without ever leaving the terminal.
Why do I need
It saved me the trouble to sign into Github, create the repository manually, just so I can clone it and work locally.
Usually when I start a new Github repository, I’ll sign in and then create the new repository. The repository will then show me instructions on how to clone, HTTPS or SSH. Depending on my setup, I’ll clone and start coding.
I started a small throw-away-project, with a local git repository. A few hours later, I decided that the code might be useful and I wanted to formally push it to a remote source control server like
My dream was to drop to the terminal and
git -u origin master, that should create and push my local repository to my Github account…of course it is not that simple :)
I searched for a github cli tool and hub came up.
It runs on macOS, Linux, Windows and a few others.
After I installed it, these are the steps I followed to create and push my local repository:
- Open terminal and navigate to source code.
hub requested my github username.
hub requested my github password.
hub requested my Two-factor authentication code.
hub create command, I had a repository in Github…magic :)
git push -u origin master(yes, my dream line becomes a reality)
I also received a Github email notification:
[GitHub] A personal access token has been added to your account
Although I only used the
create command, I would encourage you to check out the hub manual for more interesting commands.
These two commands are the magic:
git push -u origin master
Use it…don’t use it :)