Git服务器挂钩 - 它们是在客户端/克隆机器上本地执行的吗? [英] Git Server Hooks - Are they executed locally on the client/clone machine?

查看:180
本文介绍了Git服务器挂钩 - 它们是在客户端/克隆机器上本地执行的吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

安装:

我在Windows机器上有master repo,在另一台windows机器上有克隆。
在我的更新钩子中,我添加了 ipconfig 来打印IP地址。
我期待看到主人的IP地址,但实际上会打印出克隆的副本。
$ b 这让我认为,在实际推送的客户端/克隆机器上实际下载并运行本地git钩子(预接收,更新和接收后)。



如果这是正确的,那么如果对钩子应该如何写入有很多限制。例如用perl编写的钩子需要所有的客户端都有perl来在本地执行这个钩子。



有人可以证实这是否是行为?

解决方案

有一篇关于超级用户的帖子,讲述当我在使用二进制文件的网络共享上的回购站中运行Git挂钩时:



如果它是一个普通的(SMB / CIFS)网络共享,它会在客户端执行。



如果你通过SSH或HTTPS使用Git,Git(可能是一个替代实现)在远程端运行并执行钩子。



更简化:如果文件路径设置为远程,它在本地执行,即使它实际上是SSHFS或者其他东西,否则,它会远程执行。


Setup:

I have master repo on Windows machine and a clone on another windows machine. Inside my update hook, I have added ipconfig to print IP address. I was expecting to see the master's IP address, but it actually prints out clone's.

This makes me think that server-side git hooks ( pre-receive, update and post-receive ) are actually downloaded and run locally on the client/clone machine that is doing actual push.

If this is correct, then if puts a lot of restrictions on how the hook should be written. e.g. a hook written in perl shall need all clients to have perl to execute this hook locally.

Can someone confirm if this is the behaviour?

解决方案

There's a post on superuser which talks about When I run a Git hook in a repo on a network share which binaries are used:

"If it’s a regular (SMB/CIFS) network share, it’s executed on the client.

If you use Git via SSH or HTTPS, Git (possibly an alternative implementation) is running on the remote side and executes hooks.

More simplified: If you have a file path set as the remote, it’s executed locally, even when it’s actually SSHFS or whatnot. Otherwise, it’s executed remotely."

这篇关于Git服务器挂钩 - 它们是在客户端/克隆机器上本地执行的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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