GitLab Default Branch Missing

If you create a GitLab project and it has no branches, you can try use the below to add one.


  • This is run from a Windows cmd prompt.
  • The default branch preference is to now call it main rather than master.
cd \
md temp
cd temp
md gitlab
cd gitlab
git clone https://..../yourgitlabproject
cd yourgitlabproject
echo readme >
git add .
git checkout -b main
git update-ref HEAD main
git push --set-upstream origin main

Leave a Reply