title: How do I push to a repo from within a gitlab CI pipeline?
body: <p>In my CI pipeline I am generating an artifact <code>public/graph.png</code> that visualises some aspect of my code. In a later step I want to commit that to the repo from within the CI pipeline. Here's the pertinent part of <code>.gitlab-ci.yml</code>:</p>
  
  <pre><code>commit-graph:
    stage: pages
    script:
      - git config user.email "cipipeline@example.com"
      - git config user.name "CI Pipeline"
      - cd /group/project
      - mv public/graph.png .
      - git add graph.png
      - git commit -m "committing graph.png [ci skip]"
      - echo $CI_COMMIT_REF_NAME
      - git push origin HEAD:$CI_COMMIT_REF_NAME
  </code></pre>
  
  <p>When the pipeline runs within gitlab it fails with:</p>
  
  <blockquote>
    <p>$ git config user.email "cipipeline@dhgitlab.dunnhumby.co.uk"<br>
    $ git config user.name "CI Pipeline"<br>
    $ cd /group/project<br>
    $ mv public/graph.png .<br>
    $ git add graph.png<br>
    $ git commit -m "committing graph.png [ci skip]"<br>
    [detached HEAD 22a50d1] committing graph.png [ci skip]<br>
     1 file changed, 0 insertions(+), 0 deletions(-)<br>
     create mode 100644 graph.png<br>
    $ echo $CI_COMMIT_REF_NAME<br>
    jamiet/my-branch<br>
    $ git push origin HEAD:$CI_COMMIT_REF_NAME<br>
    fatal: unable to access '<a href="https://gitlab-ci-token:xxxxxxxxxxxxxxxxxxxx@example.com/group/project/project.git/" rel="noreferrer">https://gitlab-ci-token:xxxxxxxxxxxxxxxxxxxx@example.com/group/project/project.git/</a>': server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none</p>
  </blockquote>
  
  <p>Not sure what I'm doing wrong and don't know enough about SSL to understand that error. Can anyone advise?</p>
  
  <p>We are hosting gitlab ourselves by the way.</p>