如何设置对ssh git服务器的只读访问权限? [英] How can I set read only access to ssh git server?
问题描述
我的服务器上有一个git仓库,可以通过SSH推送/拉取,就像这样:
I have a git repo on my server that I can push/pull through SSH just fine like:
git clone ssh://user@domain.com/repositories/myrepo.git
它会提示我输入我的公共密钥密码,并且能够获取或推送更改,但是我想知道是否存在一种可以设置它的方式,以便人们只能通过读取访问权限来clone
因此他们不必输入任何SSH凭据.
It prompts me with my public key passcode and I'm able to fetch or push changes to it, but I was wondering if there was a way where I could set it up so people can clone
it only with read access so they don't have to enter any SSH credentials.
提前谢谢!
推荐答案
不通过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
.
这篇关于如何设置对ssh git服务器的只读访问权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!