I cloned a repository and was working in the master branch. There was a consistent problem: git push
(and git push
) didn't work and gave long, uninterpretable error message. Through trial-and-error, I found git push origin master
did the push correctly. But now I've noticed something odd:
$ git config push.default tracking
$ git push
fatal: The current branch master is not tracking anything.
WTF? I thought if you cloned a repository, the master was automatically tracked. Anyway, my real questions are
EDIT My local repository was acting strangely in other ways; most notably: I couldn't create remote branches. I put it aside and made a fresh clone, and it's acting strangely in fresh ways.
First, master
is tracking (yeah). Second, I was able to make a remote branch, but it's odd.
Ratatouille $ git push origin origin:refs/heads/premium
Total 0 (delta 0), reused 0 (delta 0)
To git@github.com:gamecrush/Ratatouille.git
* [new branch] origin/HEAD -> premium
Ratatouille $ git branch -r
origin/HEAD -> origin/master
origin/master
origin/premium
Ratatouille is the name of the remote repo, of course. The strange point: what is that ->
there for? It seems to be new and it doesn't show up for the old local repo or other clones of the remote.
But now branching and tracking work as advertised.
An alternative: to set the master to track the remote, during your first push execute:
git push -u origin master
The -u
will do the same as --set-upstream
. After, run git branch -vv
to see a list of branches including their tracking branches.
What is your branch.autosetupmerge
set to? By default it should have setup the branch tracking when you cloned.
Try setting the upstream for the branch with this to make the branch track the remote.
git branch --set-upstream master origin/master
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With