title: Why can't I copy my .git folder into my docker container
body: <p>We have got a node.js/typescript project and now I am supposed to provide data to our sonarqube analysis.</p>
  
  <p>We are using a docker container to run our tests in and after the tests are finished, we are running the sonarqube analysis so we can use the code coverage report from the tests for it. </p>
  
  <p>The only problem is, that the blame information is missing. This is why i tried to copy the .git folder into the docker container, but so far I did not succeed. This is the content of my Dockerfile.</p>
  
  <pre><code>FROM node:11.6-alpine
  RUN apk --update add openjdk8-jre
  
  WORKDIR /dist
  
  COPY package*.json ./
  
  RUN npm install
  
  COPY src/ ./src/
  COPY test/ ./test/
  COPY ts*.json ./
  COPY sonar-project.properties ./
  COPY test.sh /
  COPY .git/ ./
  
  RUN chmod +x /test.sh
  
  CMD ["sh", "/test.sh"]
  </code></pre>
  
  <p>I have read, that the .dockerignore file can be used to exclude files or folder but we are not using such a file and I also tried creating one that only contains node_modules, but that also did not work.</p>
  
  <p>Has anybody got any idea how to include it or any tipp what to google? I only find "how to exclude .git from the docker container" but reverting those tipps did not help so far.</p>
  
  <p>Edit: To make it even stranger using <code>COPY . ./</code> includes the .git folder into the image.</p>