title: How to fetch entire repository with GitLab CI/CD?
body: <p>I'm currently setting up GitLab CI/CD. We use GitVersion in our project, which throws the following error:</p>
  <p><code>/root/.nuget/packages/gitversiontask/5.3.7/build/GitVersionTask.targets(46,9): error : InvalidOperationException: Could not find a 'develop' or 'master' branch, neither locally nor remotely.</code></p>
  <p>According to <a href="https://solvedblog.com/posts/could-not-find-a-develop-or-master-branch/" rel="noreferrer">this blog</a> this happens, when the CI-server does not fetch the full repository (we have both a develop and a master branch, but I'm working on a different one). For Jenkins we solved this problem by expanding the checkout stage:</p>
  <pre><code>stage(&quot;Checkout&quot;) { gitlabCommitStatus(name: &quot;Checkout&quot;) {
      
      // These are the normal checkout instructions
      cleanWs()
      checkout scm
      
      // This is the additional checkout to get all branches
      checkout([
        $class: 'GitSCM',
        branches: [[name: 'refs/heads/'+env.BRANCH_NAME]],
        extensions: [[$class: 'CloneOption', noTags: false, shallow: false, depth: 0, reference: '']],
        userRemoteConfigs: scm.userRemoteConfigs,
      ])
  
      sh &quot;git checkout ${env.BRANCH_NAME}&quot;
      sh &quot;git reset --hard origin/${env.BRANCH_NAME}&quot;
  }}
  </code></pre>
  <p>I'm essentially looking for something equivalent to this for the <code>.gitlab-ci.yml</code> file.</p>