问题描述
当我开始使用git,我的同事告诉我的最显着的优点之一是,git不需要存在于与svn相反的服务器上。
When I started with git, one of the most prominent benefits my colleagues told me, was that git didn't need to be present on a server opposed to svn.
但这是真的吗?在中,我读到至少一个 git-upload-pack
或 git-receive-pack
将是必要的。
But is this really true? In another thread I read that at least a git-upload-pack
or git-receive-pack
would be necessary.
另一方面,我可以安全地在usb棒上有一个git仓库。
On the other hand, I can safely have a git repository on an usb stick.
那么,服务器是否需要安装任何软件,除了ssh还是不支持?
So, does the server need to have any software installed except to ssh or not?
推荐答案
不,当你说你可以在没有安装git的情况下,在你的服务器上
这是因为服务git仓库所需的一切都是存储在 .git
目录中。
No, you're correct when you're saying you can serve a git repository without have git installed on your server.This is because everything that is needed to serve a git repository, is "stored" in the .git
directory.
但是,要与服务器通信(例如,执行克隆
, push
等... ),根据您的存储库地址( refspec
)将使用某种传输。如果您使用 ssh
或 git
传输,服务器端也需要安装git。因为,像你所说的那样,它将所有以更有效格式交换的数据打包。
But, to communicate with a server (e.g. do a clone
, push
, etc...), based on your repository address (refspec
) a certain transport will be used. And if you're using the ssh
or git
transport, the server side needs to have git installed as well. Because, like you said, it 'packs' all data that is exchanged in a more efficient format.
您可以通过将远程服务器安装在文件系统上来避免这种情况,并使用'文件'运输。或者你可以为git上传自己的替代品,而不是使用它:
You could circumvent this by mounting remote server on your filesystem, and use the 'file' transport. Or you could upload your own 'alternatives' for git, and use that instead:
git clone -u /home/you/bin/git-upload-pack you@machine:code
(from:)
这篇关于git是否需要存在于服务器上才能使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!