zoukankan      html  css  js  c++  java
  • Git 先创建项目后提交到仓库[Note about fast-forwards]

    1. 初始化: 
      git init
    2. 把项目添加到本地仓储:
      git add .
      git commit -am "备注"
    3. 添加远程地址
      git remote add origin https://gitee.com/xxx/xxx.git
    4. 本地分支和远程分支  建立连接
      git branch --set-upstream-to=origin/master master
    5. 因为远程仓库是刚创建的,本地仓库和远程仓库有不同的开始点【没有共同的commit】,需要拉取代码
      git pull origin master --allow-unrelated-histories
    6. 异常就是由【4/5】导致的
      $ git push
      To https://gitee.com/xxx/xxx.git
       ! [rejected]        master -> master (non-fast-forward)
      error: failed to push some refs to 'https://gitee.com/xxx/xxx.git'
      hint: Updates were rejected because the tip of your current branch is behind
      hint: its remote counterpart. Integrate the remote changes (e.g.
      hint: 'git pull ...') before pushing again.
      hint: See the 'Note about fast-forwards' in 'git push --help' for details.
  • 相关阅读:
    VScode网页开发工具
    Java修饰符总结
    C++进阶补充
    C++进阶
    计算机简单开发的基础
    C++动态规划和递归
    C++设计模式
    C++ virtual
    C++-基于STL的演讲比赛流程管理系统
    C++6(5补充)
  • 原文地址:https://www.cnblogs.com/Cailf/p/14447570.html
Copyright © 2011-2022 走看看