第零步:设置git用户(可选)
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
第一步:初始化项目文件夹
git init
第二步:添加所有文件到缓冲区
git add .
第三步:提交代码到本地仓库
git commit -m "first commit"
第四步:添加远程仓库的地址
git remote add origin https://gitee.com/cheungming/hello.git
第五步:拉取远程分支
git pull
远程分支代码已存在,使用如下命令合并
git pull origin master --allow-unrelated-histories
第六步:推送代码到远程
git push -u origin master
其他命令请参考官方文档:https://git-scm.com/book/zh/v2