Github Repository API中说明了可以通过发送一个请求来认证,之后就能通过命令行自动新建远程仓库了。
认证
curl -u \'username\' https://api.github.com/user/repos -d \'{"name":"RepoName"}\'
| 替换值 | 说明 |
|---|---|
| username | github 的用户名 |
| RepoName | 新建的仓库名 |
| 。 |
本地新建仓库
$ touch README.md
$ git init
$ git add *
$ git commit -m "first commit"
$ git remove add origin https://github.com/yourname/RepoName.git
$ git push -u origin master
//参数-u 以后就可以直接用不带参数的git pull从之前push到的分支来pull