1.创建一个新仓库,以name命名
git init name
2.将写好的代码cp到新仓库下
3.然后将所有文件添加至暂存区
git add .
4.将暂存区 的文件提交到本地仓库,并添加提交信息 “commit”
git commit -m "commit"
5.将本地仓库和远程仓库关联起来
git remote add origin xxxxxxxx
注意这里使用远程仓库的ssh格式的url
如果使用http格式的url会提醒鉴权失败,原因:虽然配置了ssh代码但是git clone时用的时http,不是ssh所有ssh不能生效。
6.将本地仓库的内容推送到远程仓库的master分支
git push -u origin master