hub init doesnt create initialize or create remote repository

Created on 16 Jul 2018  路  5Comments  路  Source: github/hub

hub works very well in general.

man hub says

hub-init(1) Initialize a git repository and create it on GitHub.

However, when I create a new directory and use hub init ., it does create a new .git repo but doesn't create the Github repo.

Most helpful comment

makes sense.. perhaps there could be an option for hub create to initialize and create the repo on github. Since create is unique to hub, it wouldn't cause name clashes like this..

All 5 comments

Good catch! The documentation was wrong. You will have to call hub create separately to create the GitHub repository:

mkdir my-project && cd my-project
hub init -g .
hub create # creates `alphaCTzo7G/my-project` GitHub repo

Thanks for correcting this.

btw.. if there is only 1 option for hub-init i.e. -g.. maybe its better to have hub init default to hub init -g?

Also, I noticed the line Initialize a git repository and add a remote pointing to GitHub. in the updated version. By default hub init doesn't add a remote pointing to GitHub, if I dont add the option -g. So shouldn't the line and add a remote pointing to GitHub. be removed from the man hub pages for hub-init?

Or have hub init default to hub init -g?

We can't have hub init default to -g because lots of folks alias hub as git. For them, we must ensure that git init works exactly as in core git, i.e. with unchanged behavior. The -g flag is a hub extension.

The extended init command by hub isn't very useful, I think. I may remove this and other less useful extensions in a future release.

makes sense.. perhaps there could be an option for hub create to initialize and create the repo on github. Since create is unique to hub, it wouldn't cause name clashes like this..

I'd agree with @alphaCTzo7G in that adding a flag to hub create which also initialises the repo and maybe even adds the remote would be nice!

Was this page helpful?
0 / 5 - 0 ratings