无法推送git子树更改

时间:2019-12-30 20:27:51

标签: git 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 pull -s subtree 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 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.
$ 

我是子树的新手。请帮忙。

2 个答案:

答案 0 :(得分:0)

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

给出了

我在此博客评论https://coderwall.com/p/ssxp5q上找到了答案

如果在推送时遇到Updates were rejected because the tip of your current branch is behind. Merge the remote changes (e.g. 'git pull')问题(由于某种原因,尤其是git历史记录),则需要嵌套git命令,以便可以强制推送到heroku 。例如,以上述示例为例:

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

答案 1 :(得分:0)

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

执行X1 X2 而非git pull