亲测有效
适合的场景是
github上远程仓库已经建好
本地文件已经存在
现在要将本地代码推到git远程仓库保存
git init
git add .
git commit -m 'first commit'
git remote add origin git@github.com:tiankonghewo/sparkppt.git
git push -u origin master -f
这一步没有尝试,不做评价
5、获取远程库与本地同步合并(如果远程库不为空必须做这一步,否则后面的提交会失败)
git pull --rebase origin master
git push -u origin master -f 强制push
这一句很有用,不然报错
参考文章
https://www.cnblogs.com/zhangsanfeng/p/10163968.html
https://blog.youkuaiyun.com/qq_34446663/article/details/80468752