git 是否需要存在于服务器上才能使用它? [英] Does git need to be present on a server to use it?

查看:35
本文介绍了git 是否需要存在于服务器上才能使用它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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.

But is this really true? In another thread I read that at least a git-upload-pack or git-receive-pack would be necessary.

On the other hand, I can safely have a git repository on an usb stick.

So, does the server need to have any software installed except to ssh or not?

解决方案

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.

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.

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-upload-pack: command not found, how to fix this correctly )

这篇关于git 是否需要存在于服务器上才能使用它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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