问题描述
哪个有效? SSH://或Git://(文件压缩)
Which is efficient? SSH:// or Git:// (File compression)
我在Git中了解到,git协议很聪明,因为通信的两端都有一个协议代理来压缩文件传输,从而可以通过有效利用网络带宽来加快克隆速度.
I understand in Git, git protocol is smart because there is a protocol agent on both ends of communication to compress the file transfer resulting in faster clone by efficiently using the network bandwidth.
来自一本奥赖利书 I找到了以下语句.
From an O'Reilly book I found the following statements.
For secure, authenticated connections, the Git native
protocol can be tunneled over an SSH connection using
the following URL templates:
ssh: //[user@]example.com[:port]/path/to/repo.git
ssh: //[user@]example.com/path/to/repo.git
ssh: //[user@]example.com/~user2/path/to/repo.git
ssh: //[user@]example.com/~/path/to/repo.git*
我不确定作者是否如他所说.他谈到git协议通过SSH隧道传输.
I'm not sure if the author means what he says. He talks of git protocol getting tunneled over SSH.
从我的角度来看,除非您连接到git端口(代理端口),否则该协议无效.而且SSH只是未压缩的文件传输.但是根据作者的说法,如果我们使用SSH,他说git协议是通过它传输的. SSH在GIT中更智能吗?
From my perspective, unless you connect to the git port (agent port), the protocol is not in effect. And SSH is merely an uncompressed file transfer. But as per the author, if we use SSH he says the git protocol is tunneled over it. So is SSH smarter in GIT?
冯C,感谢您的回答. 网络协议(HTTP和Git)通常是只读的"当使用--enable=receive-pack
运行守护程序时,可以将Git设置为rw
.
Von C,Thanks for your answer. "Network protocols (HTTP and Git) are generally read-only" Git can be made rw
when you run the daemon with --enable=receive-pack
.
以下是我的担忧.
当他们说git协议很聪明时,就意味着当您执行git clone
时,Git服务器代理会压缩发送回客户端的数据,因此克隆应该更快.在我的用例中,我将在香港设置Git服务器,并在圣何塞和其他国家/地区使用它,因此由于延迟问题,我希望在网络上保持高效.
Following are my concerns.
When they say git protocol is smart, they mean when you execute git clone
, Git server agent compresses the data that is sent back to the client, so the clone should be faster. In my use case I'll be setting the Git server in Hongkong and using it on San Jose and other countries as well, So I want to be efficient over network due to latency concerns.
所以我的问题是,当我使用git clone ssh://user@server/reposloc
时,我也能获得git协议的好处吗?根据O'Reilly的著作,他的意思是git是通过ssh隧道传输的,那么当我没有在服务器上运行git守护程序时,git协议将如何工作.
So my question is when I use git clone ssh://user@server/reposloc
do I get the benefits of git protocol also? As per O'Reilly author book he means git is tunneled over ssh, then how does git protocol work when I don't have git daemon running on the server.
因此,使用SSh://xyz ...是否同时提供ssh和git协议的好处?
So using SSh://xyz... does it give both the benefit of ssh and git protocols?
提前了解您的答案.
推荐答案
看看此页面
唯一的哑"协议是直接HTTP,无需在服务器上进行任何特殊工作.在git://和ssh://协议中,git upload-pack
进程(不是守护程序)在与运行git fetch-pack
的客户端进行通信的服务器上分叉.在ssh://和git://中,您都可以进行智能"通信.
The only "dumb" protocol is straight HTTP, which requires no special effort on the server. In both the git:// and ssh:// protocols, a git upload-pack
process (which is not a daemon) is forked on the server that communicates with the client who's running git fetch-pack
. In both ssh:// and git://, you get "smart" communication.
这篇关于哪个是更聪明的git协议,ssh或git(over ssh)或https协议?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!