How to make a lead branch?

I cloned the repository and worked in the main branch. There was a sequential problem: git push (and git push ) did not work and gave a long, uninterpreted error message. Through a trial error, I found that git push origin master did the click correctly. But now I noticed something strange:

 $ git config push.default tracking $ git push fatal: The current branch master is not tracking anything. 

WTF? I thought that if you cloned a repository, the wizard was automatically tracked. Anyway, my real questions are:

  • How should I create a clone to track branches?
  • What are the consequences (other than current) of the lack of tracking?
  • How to fix the current situation so that my branch tracks the remote?

EDIT My local repository acted strangely in other ways; first of all: I could not create remote branches. I put him aside and made a new clone, and he acted strangely in a new way.

First, master tracks (yes). Secondly, I was able to make a remote branch, but this is strange.

 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. A strange moment: what is it for -> ? It seems new, and it does not appear for the old local repo or other remote clones.

But now branching and tracking jobs are being advertised.

+8
git
source share
3 answers

What is your branch.autosetupmerge installed in? By default, it should set up branch tracking when cloning.

Try setting upstream for the branch with this so that the branch is tracking the console.

 git branch --set-upstream master origin/master 
+23
source share

Alternative: to install the wizard for tracking the remote, the first time you click:

 git push -u origin master 

-u will do the same as --set-upstream . Then run git branch -vv to see a list of branches, including tracking branches.

+6
source share

Another alternative:

 git branch --set-upstream-to=origin/master 
+1
source share

All Articles