Git 本机协议或 SSH 推送协议之间的区别
使用 SSH 协议(ssh://)
和 Git (git://)
协议进行推送是否有性能差异?
如果我想使用 Git,我不需要设置 git 服务器守护进程并在 iptables 中打开该端口吗?当 SSH 已经设置并工作时,似乎有很多额外的工作,并且守护进程还需要额外的内存使用。
使用本机 git:// 协议一定有好处,因为 GitHub 使用它,而不是 ssh://。
Is there a performance difference between using the SSH protocol (ssh://)
or the Git (git://)
protocol for pushing?
If I want to use Git, don't I have to setup the git server dameon and open that port in iptables? Seems like a lot of extra work, and also additional memory usage for the dameon, when SSH is already setup and working.
There must be a benefit to using the native git:// protocol because GitHub uses it, instead of ssh://.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先,GitHub使用ssh作为主要协议,并且通过git协议提供只读访问权限。
git:// 将是克隆项目的最快方法,因为它没有加密和身份验证的开销。但除此之外, ssh:// 和 git:// 都具有相同的 git 特定传输优化。这就是为什么许多项目(包括 GitHub 上的项目)都使用 git:// 进行只读访问,使用 ssh 进行推送。
因此,要回答您的问题, ssh:// 最适合推送,因为 git:// 不用于推送。
First of all, GitHub uses ssh as the main protocol and the read-only access is given through the git protocol.
git:// will be the fastest way for cloning a project since it does not have the overhead of encryption and authentication. But otherwise, both ssh:// and git:// have the same git specific optimizations for transport. That is why many projects, including for those on GitHub, have git:// for read-only access and ssh for pushing to.
So to answer your question, ssh:// is best for pushing, because git:// is NOT used for pushing.
当然还有ssh的加密。
取决于您选择的协议。由于您通常希望对推送进行身份验证(并且对身份验证进行加密),因此通常使用 ssh 的设施 - 因为本质上,您将运行 git-native 协议,但通过 ssh 隧道。 (实现细节:git-daemon 和 git-push 通过 ssh 都会生成 git-receive-pack 子实用程序。)
git-daemon 服务通常提供只读匿名访问,因为这里不需要/不需要身份验证或加密。
There is ssh's encryption of course.
Depends on the protocol you choose. Since you usually want pushs to be authenticated (and the authentication be encrypted), ssh's facilities are commonly used -- since in essence, you will be running git-native protocol, but over an ssh tunnel. (Impl detail: Both git-daemon and git-push through ssh spawn the git-receive-pack subutility.)
git-daemon service is usually provided for read-only anonymous access, because neither auth nor encryption is required/desired here.