且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何设置对ssh git服务器的只读访问权限?

更新时间:2022-11-24 17:21:17

不通过ssh;除非您想向公众发布,否则他们可以登录,这是一个糟糕的主意.

Not through ssh; unless you wanted to distribute a public is they could log in with, and that is a terrible idea.

我们在gitolite上获得此功能的方法是使用git-daemon;您需要打开一个新端口,但可以指定每个存储库将服务的端口,并且可以指定只读.用户将使用git协议进行克隆,即

The way we got this functionality on our gitolite was to use git-daemon; you need to open a new port, but can specify per-repository which ones it will serve, and can specify read-only. Users would clone with the git protocol i.e.

git clone git://domain.com/repositories/myrepo.git

git clone git://domain.com/repositories/myrepo.git

另一种方法是将存储库设置为直接在Web服务器上共享.那么用户可以通过标准的http访问.

Another way is to set the repository to be shared over a web server directly; then the user could access over standard http.

git社区书此处上的页面以及相关内容都很好git-daemon的手册页.

The page on the git community book here is a good overview, along with the man pages for git-daemon.