git - 如何解决 git push 被拒绝的错误?
问题描述
╭─ksoo@ksoo-compnay ~/hisdk/mpp ‹devel*›
╰─$ git push origin devel 1 ↵
Everything up-to-date
╭─ksoo@ksoo-compnay ~/hisdk/mpp ‹devel*›
╰─$ git status
On branch devel
Your branch is up-to-date with 'origin/devel'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
include/cscope
include/cscope.files
sample/cscope.out
nothing added to commit but untracked files present (use "git add" to track)
╭─ksoo@ksoo-compnay ~/hisdk/mpp ‹devel*›
╰─$ git checkout devel
Already on 'devel'
Your branch is up-to-date with 'origin/devel'.
╭─ksoo@ksoo-compnay ~/hisdk/mpp ‹devel*›
╰─$ git push
To git@github.com:varram-suh/mpp.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:xxxx/xxxx.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and 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.
╭─ksoo@ksoo-compnay ~/hisdk/mpp ‹devel*›
╰─$ git pull 1 ↵
Current branch devel is up to date.
╭─ksoo@ksoo-compnay ~/hisdk/mpp ‹devel*›
╰─$ git push
To git@github.com:varram-suh/mpp.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:xxxx/xxx.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and 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.
git push 时出现错误,可能是分支问题。如果我指定一个分支,我不会收到错误消息。
例如,当我运行命令时
git pull origin devel
:
git push origin devel
之前没有错误。我将如何解决这个问题?
编辑:我使用 'git config --global push.default current' 解决了这个问题
之前没有报错,为什么我的 git config 变了?
解决方案
推荐阅读
- flutter - Flutter 中 cron 插件和 Timer.periodic 的区别
- python-3.x - 在 Ubuntu docker 上运行 Kivy hello world - egl_rpi - ImportError: cannot import name 'bcm'
- php - WooCommerce:获取最新产品并(部分)随机排序
- reactjs - 如果数据为空,FetchAPI GraphQL / Gatsby 在前端抛出错误
- c# - 如何减少我的 void update() 更新次数?
- javascript - 需要在页面加载时保持切换处于活动状态,并在页面加载时将其隐藏
- dart - 有没有更好的方法通过在 Dart 中添加 2 个对象键来创建对象?
- javascript - 无法拼接对象数组中的项目
- vue.js - 如何将 Google、Facebook 和 Linkedin 登录与 nuxt js 集成
- git - 对开发人员团队的 Codespaces 设置的基数感到困惑