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 push -u origin master

5.本地分支和远程分支 建立连接

git branch --set-upstream-to=origin/master master

6.因为远程仓库是刚创建的,本地仓库和远程仓库有不同的开始点【没有共同的commit】,需要拉取代码

git pull origin master --allow-unrelated-histories

7.异常就是由【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.

 

posted @   Robot-Blog  阅读(586)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 25岁的心里话
· 按钮权限的设计及实现
点击右上角即可分享
微信分享提示