无法运行hooks/post-update:没有这样的文件或目录 [英] cannot run hooks/post-update: No such file or directory
问题描述
此 http://danbarber.me/using-git-for-deployment/很棒的文章,我设法在git控制下拥有一个远程服务器.
Thx to this http://danbarber.me/using-git-for-deployment/ great article I managed to have a remote server under git control.
不幸的是,我不得不更换服务器.
Unfortunatly I had to change server.
现在完成本教程中的所有步骤并运行
Now after finishing all steps in the tutorial and running
git push origin master
我得到:
error: cannot run hooks/post-update: No such file or directory
To root@myproject.com:../var/git/myproject.git
我尝试了很多次和变化.我替换了
I 've tried many times and variations. I replaced
#!/bin/sh
对于
#!/bin/bash
在阅读 Git之后-远程:错误:无法运行hooks/post-receive:没有此类文件或目录
无论如何,我检查(多次)路径是正确的.
Anyway as far as I checked ( multiple times ) the paths are correct.
我想知道为什么它说:../var而不是:/var,但是我不知道这是从哪里来的.
I am wondering why it says :../var instead of :/var but I do not have any idea where this comes from.
关于如何重新进行这项工作的任何建议?
Any suggestions on how to make this work again?
推荐答案
如果您已授予777权限,但问题仍然存在,这是因为如果您复制了脚本文件,则脚本文件中可能会有回车符(^ M).来自vim的文本.
If you have given 777 permissions and the issue still exists it is because there might be carriage returns(^M) in the script file, if you had copied the text from vim.
要查看是否存在此问题: cat -v/path/file
如果这是问题,您可以通过 sed -i -e's/\ r//g'/path/file
To view if this is the issue: cat -v /path/file
And if this is the issue you can simply solve it by sed -i -e 's/\r//g' /path/file
这篇关于无法运行hooks/post-update:没有这样的文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!