Create a Github repository from command line

前端 未结 4 1251
死守一世寂寞
死守一世寂寞 2020-12-01 16:30

I have been trying to push my local repo changes to github from command line. I have been away from git for a while now so I don\'t remember a few things. For the past hour

4条回答
  •  我在风中等你
    2020-12-01 17:12

    You need to create the repo before pushing, but there's hub that automates this for you:

    git init newRepo
    cd newRepo
    hub create
    

    Use the -p switch to hub create to create a private repository. To push the local master branch, issue:

    git push -u origin HEAD
    

    The tool can also create pull requests, open the project page, check the CI status, clone existing repos by specifying only username/repo, and a few more things.

    The project page suggests aliasing git to hub (because the latter forwards unknown commands to git), but I don't recommend this, even if just to distinguish "bare" Git commands from the hub candy.

提交回复
热议问题