Problem with git hook for updating site

柔情痞子 提交于 2019-12-01 06:28:14

问题


I have set up a website on a server and use git to maintain it. For this reason I have created two git repositories, a bare one at $HOME/site to which I push and a non-bare one at /var/www which is supposed to pull from the bare repository every time a change is made.

In order to update the non-bare repository automatically, I have created and granted executon permission to a post-update git hook in the bare repository that contains the following:

#!/bin/bash

cd /var/www
git pull

However, after every push to the bare repository I can see the following on my terminal:

remote: fatal: Not a git repository: '.'

Is there anything I have omitted or done wrong regarding this hook?


回答1:


Try this. Add this line to your hook script before you do the git pull command:

unset $(git rev-parse --local-env-vars)

This will unset all GIT_XXX_YYY environment variables.



来源:https://stackoverflow.com/questions/6394366/problem-with-git-hook-for-updating-site

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!