git clone - default branch

Viewed 5873

After cloning a git repository from my gitlab server, it does not checkout master, as origin/HEAD points to some other branch 'origin/foo'. In gitlab, the default branch is set to master.

How can I move origin/HEAD from 'origin/foo' to point to 'origin/master', so that further clones automatically check out origin/master?

Right after cloning, git remote show origin states:

HEAD branch: foo

git remote -r seconds that:

origin/HEAD -> origin/foo

I want the HEAD branch to point to master, though - inside gitlab - the default branch is already set to master.

3 Answers
Related