我创建了一个新的本地 Git 存储库:
I created a new local Git repository:
~$ mkdir projectname ~$ cd projectname ~$ git init ~$ touch file1 ~$ git add file1 ~$ git commit -m 'first commit'是否有任何 git 命令来创建一个新的 远程 存储库并将我的提交从这里推送到 GitHub?我知道启动浏览器并没有什么大不了的转到创建新存储库,但如果有办法从 CLI 实现这一点,我会很高兴.
Is there any git command to create a new remote repo and push my commit to GitHub from here? I know it's no big deal to just fire up a browser and head over to Create a New Repository, but if there is a way to achieve this from the CLI I would be happy.
我阅读了大量文章,但我发现没有一篇提到如何使用 git 命令从 CLI 创建远程存储库.Tim Lucas 的好文章 Setting a new remote git repository 是我发现的最接近的文章,但 GitHub 确实如此不提供外壳访问.
I read a vast amount of articles but none that I found mention how to create a remote repo from the CLI using git commands. Tim Lucas's nice article Setting up a new remote git repository is the closest I found, but GitHub does not provide shell access.
推荐答案使用 Github 的官方新命令行界面:
With Github's official new command line interface:
gh repo create查看其他详细信息和选项和安装说明.
例如,要完成您的 git 工作流程:
For instance, to complete your git workflow:
mkdir project cd project git init touch file git add file git commit -m 'Initial commit' gh repo create git push -u origin master更多推荐
是否可以在不打开浏览器的情况下从 CLI 在 GitHub 上创建远程存储库?
发布评论