授予对git存储库的只读访问权限 [英] Give Read-only access to a git repository

查看:580
本文介绍了授予对git存储库的只读访问权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定这是应该在此处还是在超级用户上使用(因为这似乎与这两个主题都有关),所以我将其放在此处,如果不合适,我将在超级用户上询问它.

I'm not sure if this should go here, or on superuser (as it seems to pertain to both topics), so I've put it here, if it's not appropriate, I'll go ask it on superuser.

无论如何,我有一个无法完全开源的git存储库(否则我将其放在github上并用它完成),并且我有一个具有ssh访问权限(但没有超级用户访问权限)的服务器到此服务器上已经有所有的git二进制文件.我需要给某人对该git-repo的只读访问权限(或至少对某些分支的只读访问权限,尽管我认为这要困难得多).

Anyway, I have a git repository that can't go completely open source (otherwise I would just put it on github and be done with it), and I have a server that I have ssh access (but not superuser access) to, this server has all of the git binaries already on it. I need to give someone read-only access to this git-repo (or at least read-only access to some of the branches, although I would imagine that's a lot harder).

当前,我正在使用ssh将本地git repo推送并轮询到该服务器.有什么方法可以授予他人对服务器的只读访问权限? (我想我俩都对存储库具有写访问权,尽管我不确定如何使用unix权限来做到这一点,因为我没有超级用户,所以我无法创建新的unix组权限).

Currently I'm using ssh to push and poll my local git repo to this server. Is there any way to give another person read only access to the server? (I suppose I am fine with us both having write access to the repo, although I'm not sure how to do that with unix permissions, as I don't have the ability to make new unix groups as I don't have superuser permissions).

谢谢您的帮助.

推荐答案

您要使用git协议. http://www.kernel.org/pub/software /scm/git/docs/git-daemon.html

You want to use the git protocol. http://www.kernel.org/pub/software/scm/git/docs/git-daemon.html

它将对所有人公开,这也许不是您想要的,但是没有人能够通过git://进行推送.

It'll be public to everybody, which may not be what you want, but nobody will be able to do a push over git://.

您可以通过仅推动您希望对其访问的分支来控制它们可以访问哪些分支.
我可以通过从启用了ssh的专用存储库中创建一个单独的克隆,然后将其添加为远程来做到这一点.然后您可以执行git push pub public-branch,这样就无法从该位置访问private-branch.

You can control what branches they can access by only pushing the branches you want to be accessible to it.
I would do this by having a separate clone from your ssh enabled private repository, and then add that as a remote. Then you can do git push pub public-branch, so then private-branch won't be accessible from that location.

这篇关于授予对git存储库的只读访问权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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