Git hook/post-receive 没有那个文件或目录
Git hook/post-receive No such file or directory
所以我有一个裸存储库,我们用它来控制对网页的更改。在那个裸仓库上有一个 post-receive 挂钩,当我们将更改推送到它时它会运行。钩子所做的只是使用以下代码实现对工作目录的更改:
WRK_DIR="/url/to/work/tree/"
GIT_DIR="/url/to/bare/repo.git/"
#Update WRK_DIR with changes pushed into GIT_DIR...
git --work-tree=$WRK_DIR --git-dir=$GIT_DIR checkout -f
无论出于何种原因,我收到以下信息:
remote: fatal: Not a git repository: '/url/to/bare/repo.git/'
我已验证挂钩 运行 在正确的用户下,并且具有文件夹的权限。但是无论出于何种原因,挂钩都找不到目录,我绝对确定 url 是正确的。
运行
cd /url/to/bare/repo.git/
从钩子内部也返回
remote: hooks/post-receive: line 13: cd: /url/to/bare/repo.git/: No such file or directory
就像我说的,我确信 url 是正确的并且没有错字。任何帮助将不胜感激。
已解决
The hooks along with the bare repo were on the server so I placed some cd 's in the hook to test what it returned. Strangely it returned the contents of my local machine... have no idea why but if I change the variables to the network location of the folders and escape the backslashes it executes fine.
所以我有一个裸存储库,我们用它来控制对网页的更改。在那个裸仓库上有一个 post-receive 挂钩,当我们将更改推送到它时它会运行。钩子所做的只是使用以下代码实现对工作目录的更改:
WRK_DIR="/url/to/work/tree/"
GIT_DIR="/url/to/bare/repo.git/"
#Update WRK_DIR with changes pushed into GIT_DIR...
git --work-tree=$WRK_DIR --git-dir=$GIT_DIR checkout -f
无论出于何种原因,我收到以下信息:
remote: fatal: Not a git repository: '/url/to/bare/repo.git/'
我已验证挂钩 运行 在正确的用户下,并且具有文件夹的权限。但是无论出于何种原因,挂钩都找不到目录,我绝对确定 url 是正确的。
运行
cd /url/to/bare/repo.git/
从钩子内部也返回
remote: hooks/post-receive: line 13: cd: /url/to/bare/repo.git/: No such file or directory
就像我说的,我确信 url 是正确的并且没有错字。任何帮助将不胜感激。
已解决
The hooks along with the bare repo were on the server so I placed some cd 's in the hook to test what it returned. Strangely it returned the contents of my local machine... have no idea why but if I change the variables to the network location of the folders and escape the backslashes it executes fine.