利用 CLI 新建 GitHub 仓库
GitHub does not provide shell access !
用过 GitHub 的都知道,一般通过它的网页接口来创建新的仓库 Repository。
由于 GitHub 不提供 Shell Access 的权限,所以无法通过普通的终端命令来新建 Repository。
那么,有没有什么办法能利用 CLI 来新建 Repository 呢?
其实,我们可以利用 GitHub 提供 Repository API 来做到。API 告诉我们可以通过发送 HTTP 请求来新建仓库,显然 git 命令无法使用,但是可以利用 curl 这个工具做到。
GitHub API 新建远程 Repository
GitHub Create Repository API 规范:
POST /user/repos
# Input data example:
{
"name": "Hello-World",
"description": "This is your first repository",
"homepage": "https://github.com",
"private": false,
"has_issues": true,
"has_wiki": true,
"has_downloads": true
}
