Git如何用指令创建远程仓库

发布于 2018-08-06 | 作者: chent86 | 来源: CSDN博客 | 转载于: CSDN博客

Git 如何用指令创建远程仓库

创建仓库不一定要登录github网站,我们实际上可以在本地通过命令行进行操作

git init          //git add . 和 git commit 也是必要的, 这样做会生成master主分支,否则后续push会有报错 error: src refspec master does not match any.
curl -u '用户名' https://api.github.com/user/repos -d '{"name":"仓库名"}'
git remote add origin https://github.com/用户名/仓库名.git
                 //或者使用ssh,避免输入密码 
                 //git remote add origin git@github.com:用户名/仓库名.git
git push origin master