为什么我不能将更改推送到这个最新的 Git 子树?

Why can't I push change to this up-to-date Git subtree?

我在子目录 "gempak/tables" 中有一个名为 "gempak-tables" 的 git 子树模块:

$ git config -l | grep -i gempak
remote.gempak-tables.url=git@github.com:Unidata/GEMPAK-Tables.git
remote.gempak-tables.fetch=+refs/heads/*:refs/remotes/gempak-tables/*
$

我无法将对子树模块的更改推送到 GitHub,但是:

$ git subtree push --prefix=gempak/tables gempak-tables master
git push using:  gempak-tables master
X11 forwarding request failed on channel 0
To git@github.com:Unidata/GEMPAK-Tables.git
 ! [rejected]        89d8f94d010e6677f146608674cf7408eecb4a61 -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:Unidata/GEMPAK-Tables.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
$ 

即使子树模块似乎是最新的:

$ git subtree pull --prefix=gempak/tables gempak-tables master
X11 forwarding request failed on channel 0
From github.com:Unidata/GEMPAK-Tables
 * branch            master     -> FETCH_HEAD
Already up-to-date.
$ 

我的 git(1) 版本:

$ git --version
git version 1.8.3.1

我是子树新手。请帮忙。

答案很可能已经由 Git subtree - subtree up-to-date but can't push

给出

I found the answer on this blog comment https://coderwall.com/p/ssxp5q

If you come across the Updates were rejected because the tip of your current branch is behind. Merge the remote changes (e.g. 'git pull') problem when you're pushing (due to whatever reason, esp screwing about with git history) then you'll need to nest git commands so that you can force a push to heroku. e.g, given the above example:

git push heroku `git subtree split --prefix pythonapp master`:master --force

您收到的错误表明您的 git 分支落后了。包含最新子树的 git 分支不是最新的。

git pull 而不是 git subtree pull