title: gitlab ci does not update code at remote server
body: <p>I want to deploy ma test app from local repo to gitlab repo and with gitlab ci push it to my remote server. SSH connection is working, gitlab CI shows that job is passed, but code on remote server is not updated.</p>
  
  <p>I made bare repo in: /home/repos/testDeploy.git</p>
  
  <p>And folder for files is in: /home/example.com/web/testDeploy</p>
  
  <p>I added</p>
  
  <p><strong>My .gitlab-ci.yml file</strong></p>
  
  <pre><code>stages:
    - deploy
  
  deployment:
    stage: deploy
      environment:
        name: production
        url: http://www.example.com/testDeploy
  
     only:
        - master
  
     before_script:
        - 'which ssh-agent || ( apt-get update -y &amp;&amp; apt-get install openssh-client -y )'
        - eval $(ssh-agent -s)
        - chmod 600 ~/.ssh/id_rsa_gitlab &amp;&amp; chmod 700 ~/.ssh
        - '[[ -f /.dockerenv ]] &amp;&amp; echo -e "Host *\n\tStrictHostKeyChecking no\n\n" &gt; ~/.ssh/config'
  
     script:
        - git remote add production ssh://user@server:port/home/repos/testDeploy.git
        - git push -f production master
        - echo "Deployed to production!"
  </code></pre>
  
  <p>Also, i have post-receive hook:</p>
  
  <pre><code>#!/bin/sh
  git --git-dir=/home/repos/testDeploy.git --work-tree=/home/example.com/web/testDeploy checkout -f
  </code></pre>
  
  <p>I make changes in my local repo, commit and push to origin master to gitlab. Job is passed, but as I mention above, file on remote server is not update. </p>
  
  <p>Output from gitlab job is:</p>
  
  <pre><code>Fetching changes...
  HEAD is now at 595db67 as
  Checking out 595db67b as master...
  Skipping Git submodules setup
  $ which ssh-agent || ( apt-get update -y &amp;&amp; apt-get install openssh-        client -y )
  /usr/bin/ssh-agent
  $ eval $(ssh-agent -s)
  Agent pid 40589
  $ chmod 600 ~/.ssh/id_rsa_gitlab &amp;&amp; chmod 700 ~/.ssh
  $ [[ -f /.dockerenv ]] &amp;&amp; echo -e "Host *\n\tStrictHostKeyChecking    no\n\n" &gt; ~/.ssh/config
  $ git branch
  * (HEAD detached at 595db67)
  master
  production
  $ git push -f production master
  Everything up-to-date
  $ echo "Deployed to production!"
  Deployed to production!
  Job succeeded
  </code></pre>
  
  <p>What I am doing wrong? Can you someone help me please to figure it out? Thank you for all your answers.</p>