1、git init

2、将文件提交到git仓库管理
git add + 需要添加的文件名 或者git add --all 将所有的文件全部添加

3、将git管理的文件提交到本地仓库,git commit -m "提交备注"

4、在github上创建远程代码仓库
5、将本地的仓库关联到github上
git remote add origin https://github.com/5678/888.git

6、拉取远程分支代码并合并
git pull --rebase origin master

7、将本地仓库代码提交到远程git仓库
git push -u origin master

使用上面的命令提交时报错了,是因为本地没有README.md或该文件与远程仓库的README.md冲突,可以使用下面命令强制提交。
git push -u origin master -f

网友评论