title: Git fetch tags but missing latest version
body: <p>Recently I upgrade my gitlab( 8.17.3 -&gt; 12.10.9 ). Everything works fine after upgrading git.</p>
  <p>But occasionally, some project cannot fetch full tags(missing latest version). When working with jenkins, the error message is &quot;Couldn't find any revision to build. Verify the repository and branch configuration for this job&quot;.</p>
  <p>git clients version are : 1.7.1.2, 1.8.3.1, 2.8.4 and 2.22.0</p>
  <p>How to reproduce:</p>
  <pre><code>git init test ;
  cd test ;
  git fetch --tags --progress http://url_to_git/abc.git &quot;+refs/heads/*:refs/remotes/origin/*&quot;  --prune
  
  ...
  From From http://url_to_git/abc.gi
   * [new branch]      Dev_Long_Br -&gt; origin/Dev_Long_Br
   * [new branch]      ft_dev_0805_ppt -&gt; origin/ft_dev_0805_ppt
   * [new branch]      ft_dev_0911 -&gt; origin/ft_dev_0911
   * [new branch]      master     -&gt; origin/master
   * [new tag]         dev_fiba_dmm_20190302_1028 -&gt; dev_fiba_dmm_20190302_1028
   * [new tag]         rls_fiba_dmm_20191126 -&gt; rls_fiba_dmm_20191126
  </code></pre>
  <p>The result seems that missing latest branch &quot;rls_0929 &quot;. But wait for a while to retry fetch tags, I got the latest branch</p>
  <pre><code>git fetch --tags --progress http://url_to_git/abc.git &quot;+refs/heads/*:refs/remotes/origin/*&quot;  --
  ...
   From http://url_to_git/abc.git
     7501d7d..1a9a602  ft_dev_0911 -&gt; origin/ft_dev_0911
   * [new branch]      rls_0929   -&gt; origin/rls_0929
  </code></pre>
  <p>If I remove <code>.git</code> directory, redo <code>fetch tags</code>, everything seems to be right.</p>
  <p>Work step is as follows:</p>
  <pre><code>rm -rf .git
  retry fetch
  git init; git fetch --tags --progress http://url_to_git/abc.git &quot;+refs/heads/*:refs/remotes/origin/*&quot;  --prune
  ...
  
   From From http://url_to_git/abc.gi
   * [new branch]      Dev_Long_Br -&gt; origin/Dev_Long_Br
   * [new branch]      ft_dev_0805_ppt -&gt; origin/ft_dev_0805_ppt
   * [new branch]      ft_dev_0911 -&gt; origin/ft_dev_0911
   * [new branch]      master     -&gt; origin/master
   * [new branch]      rls_0929   -&gt; origin/rls_0929
   * [new tag]         dev_fiba_dmm_20190302_1028 -&gt; dev_fiba_dmm_20190302_1028
   * [new tag]         rls_fiba_dmm_20191126 -&gt; rls_fiba_dmm_20191126
  </code></pre>
  <p>I use nfs as the storage service, is it a storage cache problem
  nfs server info：</p>
  <pre><code> # rpm -qa|grep nfs
  libnfsidmap-0.25-15.el7.x86_64
  nfs-utils-1.3.0-0.33.el7_3.x86_64
  [root@gitpprdtools-prod34 ~]# service nfs status
  Redirecting to /bin/systemctl status  nfs.service
  ● nfs-server.service - NFS server and services
     Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; enabled; vendor preset: disabled)
     Active: active (exited) since Sat 2020-07-18 00:14:18 CST; 2 months 12 days ago
   Main PID: 16701 (code=exited, status=0/SUCCESS)
     CGroup: /system.slice/nfs-server.service
  </code></pre>
  <p>NFS client/gitlab app server info:</p>
  <pre><code>mount|grep git-data
  NFS_IP:/var/opt/gitlab/git-data on /var/opt/gitlab/git-data type nfs (rw,relatime,vers=3,rsize=1048576,wsize=1048576,namlen=255,soft,proto=tcp,timeo=600,retrans=2,sec=
  sys,mountaddr=NFS_IP,mountvers=3,mountport=20048,mountproto=udp,local_lock=none,addr=NFS_IP)
  </code></pre>
  <p>The branch actually exists on  remote git server.  I doubt that is it a nfs problem, My git server is  4 git app server with one vip and mount same  nfs storage. When error happens, the git server which client really request  that has the  nfs cache which  not having the latest branch. So I modify my setting as git doc, but error continues
  <a href="https://docs.gitlab.com/12.10/ee/administration/high_availability/nfs.html" rel="nofollow noreferrer">https://docs.gitlab.com/12.10/ee/administration/high_availability/nfs.html</a> .</p>
  <p>In jenkins, when specify branch to build and the missing lastest branch error happens, the error is as followed:</p>
  <pre><code>Started from command line by jenkinsadmin
  Building remotely on docker10-2.64 (C++ docker10 docker) in workspace /data/jenkins/workspace/workspace/Flow_dockerMakePackage_5387053_774
  Cloning the remote Git repository
  Cloning repository http://git.a.com/b/c.git
   &gt; git init /data/jenkins/workspace/workspace/Flow_dockerMakePackage_5387053_774 # timeout=10
  Fetching upstream changes from http://git.a.com/b/c.git
   &gt; git --version # timeout=10
  using GIT_ASKPASS to set credentials root_gitlab
   &gt; git fetch --tags --progress http://git.a.com/b/c.git +refs/heads/*:refs/remotes/origin/* # timeout=30
   &gt; git config remote.origin.url http://git.a.com/b/c.git # timeout=10
   &gt; git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
   &gt; git config remote.origin.url http://git.a.com/b/c.git # timeout=10
  Cleaning workspace
   &gt; git rev-parse --verify HEAD # timeout=10
  No valid HEAD. Skipping the resetting
   &gt; git clean -fdx # timeout=10
  Pruning obsolete local branches
  Fetching upstream changes from http://git.a.com/b/c.git
  using GIT_ASKPASS to set credentials root_gitlab
   &gt; git fetch --tags --progress http://git.a.com/b/c.git +refs/heads/*:refs/remotes/origin/* --prune # timeout=30
   &gt; git rev-parse b215fc6cf5a4f431408773e3e05130a72f263546^{commit} # timeout=10
   &gt; git rev-parse origin/b215fc6cf5a4f431408773e3e05130a72f263546^{commit} # timeout=10
   &gt; git rev-parse b215fc6cf5a4f431408773e3e05130a72f263546^{commit} # timeout=10
  ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
  </code></pre>
  <p>Can anyone help?</p>