git仓库已经建立过远程链接时的命令

之前做官网用vscode编辑器,自带git推送功能,这不好久没用,用uniapp做小程序再次推送代码就遇到了一些小问题,没关系,我还年轻,遇到的问题越多,积攒的经验就越多

  1. 找到小程序的文件夹
  2. 在小程序的的文件夹里面(有好多文件的目录下)
  3. 点击右键唤醒出 git bush here 😝
  4. 第一步操作:初始化(代表要对现有的某个项目开始用 Git 管理)~git init
  5. 第二步操作 。。。。和第一次一样

这次的问题是,推送的时候报错

hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

提示:更新被拒绝,因为远程包含您所做的工作

提示:本地没有。这通常是由另一个存储库推送引起的

提示:到同一个ref。您可能希望首先集成远程更改

提示:(例如,“git pull…”)然后再推。

提示:有关详细信息,请参阅“git push--help”中的“关于快进的说明”。

原因分析:

我提交代码时有个单词打错了,

问题解决

失败了很多次,删除.git文件也是不行的,最后还是强制提交有效,嘿嘿🤭
强制更新代码为:git push -u origin +master
当然要注意你之前提交过代码没,我这是新建的仓库,如果之前提交过代码,建议先保存下拉

第二次推送

  1. git add .
  2. git commit -m 'second'
  3. git push -u origin master

原因分析

第一次的时候已经建立过远程链接,第二次推送的时候就不必再写了,只有上面的三步

posted @ 2020-06-17 18:20  张尊娟  阅读(242)  评论(0编辑  收藏  举报