hub create

Created on 2 Aug 2017  路  18Comments  路  Source: github/hub

First, I dont get if this is a local or remote repo.

I can create a local with git as well, so I would not get the sense of hub create here.
If it's meant as a remote repo, this is what I get on git push:

fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin master

Secondly, the command here seems to be hub create, not git create?

screenshot_20170802_132444

It's at least not working with git create here: git create is not a git command
While it is working with hub create.

Thanks a lot in advance

All 18 comments

One more thing:

https://hub.github.com/hub.1.html

No ORGANIZATION/ here:
screenshot_20170802_142347

Then not here in the header, while part of the description:

screenshot_20170802_143003

And then finally here, in another syntax:

screenshot_20170802_142837

And not working in both cases:

screenshot_20170802_142554

There seems to be some misalignment between emphasising the hub command and aliasing hub with git in different documentation (ghpages vs manpages vs readme). I guess depending on what the maintainers are biasing users towards (using hub vs the aliased git) they should try to focus on... My preference would be hub with the option to alias.

I'm curious to hear what the maintainers say.

For the hub create command, assuming you have an existing git repository, you can do the following:

hub create -d "Test" # this creates the repo "hub" in your own users' namespace with description "Test"
hub create -d "Test" someorg/hub # this creates the repo "hub" in "someorgs" namespace, assuming you have the proper authorization

The git create command doesnt work here currently. Does it for you?

Yes but I added this to my .bashrc file which aliases "git" with "hub" allowing git to initiate any git or hub command.

eval "$(hub alias -s)"

Instructions for aliasing are here: https://github.com/github/hub#aliasing

Yeah fine. This change anything on the documentation?

It is covered in both README and ghpages site - but there are stylistic differences and perhaps ghpages is not explicit enough?

@mislav - do you think there is room for improvement in docs for being more explicit?

This is the current documentation which you get with hub help create on the master branch (available as prereleases):

Usage: hub create [-poc] [-d <DESCRIPTION>] [-h <HOMEPAGE>] [[<ORGANIZATION>/]<NAME>]

Create a new repository on GitHub and add a git remote for it.

## Options:
        -p
                Create a private repository.

        -d <DESCRIPTION>
                Use this text as the description of the GitHub repository.

        -h <HOMEPAGE>
                Use this text as the URL of the GitHub repository.

        -o, --browse
                Open the new repository in a web browser.

        -c, --copy
                Put the URL of the new repository to clipboard instead of printing it.

        [<ORGANIZATION>/]<NAME>
                The name for the repository on GitHub (default: name of the current working
                directory).

                Optionally, create the repository within <ORGANIZATION>.

## Examples:
                $ hub create
                [ repo created on GitHub ]
                > git remote add -f origin [email protected]:USER/REPO.git

                $ hub create sinatra/recipes
                [ repo created in GitHub organization ]
                > git remote add -f origin [email protected]:sinatra/recipes.git

When the master branch is released, this will become the official documentation on the site.

Do you think this latest documentation is better?

  1. It suggests writing hub create instead of git create because it doesn't assume that hub was aliased as git;
  2. It clearly documents the ORGNAME/REPONAME syntax.

@ShalokShalom The correct syntax would be simply hub create KPC-quarantine-area/hub instead of pasting the whole URL. Is there anything else unclear?

Yeah, this is much more clear. Recognise, that the homepage still shows the old version.

And it still seems confusing to me, which USER/REPO get used, when hub create get triggered without any additional arguments.

And it still seems confusing to me, which USER/REPO get used, when hub create get triggered without any additional arguments.

If you don't pass any arguments to hub create, the default USER/REPO will be:

  • USER: your username on GitHub ("ShalokShalom")
  • REPO: the name of the local project's directory (e.g. "myproject" when in "/path/to/myproject" directory).

Then maybe mention that too.

From where knows hub that? Does it ask me for my login details, when i launch this command?

Most (if not all) hub commands will ask for login details when first launched. This is not specific to hub create. Also, isn't it intuitive that a comamand whose description is "Create a repository on GitHub" would create one under your personal account by default?

Yes.

Could hub create prompt you whether you want public or private? Or if that's too difficult, how about making hub create -p be the default, and letting the user make it public if they want to?

It's not obvious that it will be public by default. I'm using the fish completions, and there's no indication of that.

Of course public by default.

I have multiple git alias such as `alias gac = "git add -A; git commit".

It seems there are 2 different methods suggested to alias hub to git:

  1. "alias git=hub" https://hub.github.com/

  2. eval "$(hub alias -s)"

What is the difference between the 2 methods..

Will my other git aliases work, if I use either of them? Which one is preferred and why?

@alphaCTzo7G The 2nd one is preferred for long-term use by putting this in your ~/.bash_profile or similar shell initialization script. The 1st one is preferred for examples (such as on our site) where the alias is temporarily configured in the current shell so that git commands expanded by hub could be demonstrated.

Anyway, this issue is not the correct thread to discuss this, since the original thread was about hub create and not aliases.

makes sense.. thanks for the clarification.

Closing since we clarified the behavior in this thread and the create docs in the master branch are vastly improved.

Was this page helpful?
0 / 5 - 0 ratings