title: git rev-parse HEAD fails in Jenkins with bitbake after switching to https from clear git
body: <p>The problem is that the command:</p>
  <p><strong>git rev-parse HEAD</strong></p>
  <p>inside of the retrieved repository fails when retrieved under https but only on our Jenkins server called by bitbake.</p>
  <p>I have switched our Jenkins server build back and forth between:
  <a href="https://git.multitech.net/cgit/mlinux.git/" rel="nofollow noreferrer">https://git.multitech.net/cgit/mlinux.git/</a>
  and
  git://git.multitech.net/mlinux.git</p>
  <p>If I do this outside of bitbake and Jenkins this works fine.  Running in Jenkins works fine. Running bitbake outside of Jenkins is fine. But the combination of bitbake and Jenkins fails.</p>
  <p>I ran strace, and in a successful <strong>git rev-parse HEAD</strong>, it calls geteuid().</p>
  <p>In the unsuccessful case, run from bitbake, it never calls geteuid().  It is supposedly running as the same user. In the same bitbake execution, it returns the same UID every time in other commands run prior <strong>to git rev-parse HEAD</strong>.</p>
  <p>If you look at the execution of git, it calls lstat on the directory in question eight times and gets st_uid=1001 each time.  Each time the result is 0, which the source also checks.</p>
  <p>The error:</p>
  <pre><code>fatal: detected dubious ownership in repository at '/home/jenkins/workspace/mlinux/nightly'
  To add an exception for this directory ...
  </code></pre>
  <p>Since the code never called geteuid() in this case, how does it know the directory is of dubious ownership?  I have also tried using env -i to remove the environment from the execution of git by wrapping it with a shell script. This did not help.</p>
  <pre><code>root@buildslavemtcdt3dm2:/home/jenkins/workspace/mlinux# find nightly ! -user 1001
  [Nothing is returned]
  </code></pre>