Creando un repositorio git desde una carpeta de producción

Tengo una máquina con un sitio web de producción, quiero crear un repositorio git en esa máquina para administrar el sitio web utilizando git.

Así que lo primero que hice fue crear un repositorio .git vacío en la máquina de producción:

mkdir repos
cd repos
mkdir production.git
cd production.git
git init --bare

En este repositorio, en ganchos / post-recepción, he agregado las siguientes líneas:

#!/bin/sh
GIT_WORK_TREE=/var/www/production_website git checkout -f

Luego descargué la carpeta con mi sitio web de producción en mi máquina local e inicié git:

cd production_website
git init

Después de eso hice el primer commit:

git add .
git commit -m "first commit"

Y finalmente, agregué el repositorio remoto y realicé mi primer impulso:

git remote add origin ssh://[email protected]/repos/production.git
git push origin master

Pero cuando hago el empuje me da el siguiente mensaje de error:

remote: fatal: This operation must be run in a work tree

Que se activa cuando se activa el gancho posterior a la recepción.

¿Alguna sugerencia de lo que podría estar haciendo mal?

ACTUALIZAR:

En el primer paso, al crear un repositorio .git vacío en la máquina de producción, si usogit init en lugar degit init --bare Recibo este mensaje de error al hacer un empuje:

remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, updating the current branch in a non-bare repository
remote: error: is denied, because it will make the index and work tree inconsistent
remote: error: with what you pushed, and will require 'git reset --hard' to match
remote: error: the work tree to HEAD.
remote: error: 
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
remote: error: its current branch; however, this is not recommended unless you
remote: error: arranged to update its work tree to match what you pushed in some
remote: error: other way.
remote: error: 
remote: error: To squelch this message and still keep the default behaviour, set
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.

Respuestas a la pregunta(1)

Su respuesta a la pregunta