11

I have a git subtree module called "gempak-tables" in subdirectory "gempak/tables":

$ 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/*
$

I can't push changes to the subtree module to GitHub, however:

$ 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.
$ 

even though the subtree module appears to be 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.
$ 

My git(1) version:

$ git --version
git version 1.8.3.1

I'm a subtree novice. Please help.

Anthony Mastrean
  • 21,850
  • 21
  • 110
  • 188
Steve Emmerson
  • 7,702
  • 5
  • 33
  • 59

2 Answers2

0

The answer is most probably given already by 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

B--rian
  • 5,578
  • 10
  • 38
  • 89
0

The error you receive says that your git branch is behind. The git branch which contains the up to date subtree is not up to date.

Do a git pull not a git subtree pull

Tin Nguyen
  • 5,250
  • 1
  • 12
  • 32
  • 1
    That didn't fix the problem. The "git pull" obtained the message "Already up-to-date" message and a subsequent "git subtree push --prefix=gempak/tables gempak-tables master" resulted in the same error as before. – Steve Emmerson Feb 18 '20 at 15:25