Git状态显示为“最新”:
[p] vh/prodos3_v3_graphs☰ * 1 ± git status -uno
On branch vh/prodos3_v3_graphs
Your branch is up-to-date with 'origin/vh/prodos3_v3_graphs'.
nothing to commit (use -u to show untracked files)
但是git push失败:
[p] vh/prodos3_v3_graphs☰ * ± git push
Username for 'https://git.42.de': vheinitz
Password for 'https://me@git.42.de':
To https://git.42.de/repo/prodos3.git
! [rejected] master -> master (non-fast-forward)
! [rejected] prodos3_v3_developer-all -> prodos3_v3_developer-all (non-fast-forward)
error: failed to push some refs to 'https://git.42.de/repo/prodos3.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在输出中提到master?我不想推送master,对该分支没有特权。
答案 0 :(得分:3)
看来您有两个问题
关于最新消息:您当前的本地远程分支是最新的,但服务器远程分支不是最新的。
执行git pull
以更新您的本地“远程分支”,然后执行推送
git pull origin prodos3_v3_graphs
另一个问题是您要推送所有本地分支。
您可以使用git push <remote> <branch>
指定要推送的分支,例如:
git push origin prodos3_v3_graphs
或者您可以配置git推送到当前分支
git config --global push.default current
然后执行git push
希望这会有所帮助:)