git hook 合并后 - 错误:无法运行
为了在拉动后触发 git hook,我创建了一个合并后钩子。 该脚本如下所示:
#!/bin/sh
git log > gitlog.txt
该文件称为“合并后”,并且与运行 pull 命令的文件具有相同的所有者。它还具有正确的权限:755。
当您执行 git pull [remote] master 操作时,我收到此错误:
error: cannot run .git/hooks/post-merge: No such file or directory
合并后文件位于 .git/hooks 文件夹中。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能需要检查 sh 后面是否没有 CR 或类似的不可见字符。
当文件通过 Windows 系统时有时会发生这种情况。
我认为在 vi 中它会显示 ^M
如果是这种情况,请将其删除,它应该可以工作。
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.