git钩后合并 - 错误:无法运行 [英] git hook post-merge - error: cannot run

查看:97
本文介绍了git钩后合并 - 错误:无法运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我做了一个后合并钩子之后触发一个git钩子。
脚本如下所示:

 #!/ bin / sh 
git log> gitlog.txt

该文件被称为合并后,并拥有与所有者相同的所有者运行pull命令。



当你做我的git拉[远程]主人我得到这个错误:

 错误:无法运行.git / hooks / post-merge:没有这样的文件或目录

合并后文件位于.git / hooks文件夹中。

解决方案

您可能想要检查sh后面是否没有CR或类似隐形字符。 b

有时当文件通过windows系统时会发生这种情况。



我认为在vi中会显示一个^ M



如果是这种情况,请删除它,它应该可以正常工作。


To trigger a git hook after a pull i made a post-merge hook. The script looks like this:

#!/bin/sh
git log > gitlog.txt

The file is called 'post-merge' and has the same owner as the one that runs the pull command. Also it has the right permissions : 755.

When u do i git pull [remote] master i get this error:

error: cannot run .git/hooks/post-merge: No such file or directory

The post-merge file is in the .git/hooks folder.

解决方案

You may want to check if there is no CR or similar invisible character behind the sh.

This happens sometimes when a file passed through a windows system.

I think in vi it will show up a ^M

If that is the case remove it and it should work.

这篇关于git钩后合并 - 错误:无法运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆