git Github 限制访问
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9418705/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Github restricting access
提问by jignesh
I am using github.
我正在使用github。
I'm trying to figure out how to restrict repo access for a contractor i have.
我想弄清楚如何限制我拥有的承包商的回购访问权限。
I have the main rails codebase and i also have a contractor that will be doing some css/ux type work for me.
我有主要的 Rails 代码库,我还有一个承包商,他将为我做一些 css/ux 类型的工作。
I want to give the contractor the ability to check in code to git hub only to certain folders.
我想让承包商能够将代码签入 git hub 只到某些文件夹。
Ideally, i can have him checkin code and then it can be deployed out to the server so that he can see the changes.
理想情况下,我可以让他签入代码,然后可以将其部署到服务器,以便他可以看到更改。
I don't think i can do this via limiting access within a specific git repo, but maybe there is a way to use two repo's and restrict access that way.
我不认为我可以通过限制特定 git 存储库中的访问来做到这一点,但也许有一种方法可以使用两个存储库并以这种方式限制访问。
Any help would be appreciated!
任何帮助,将不胜感激!
采纳答案by Andy
If all of the css/ux files are within a particular subfolder, and you want him to have access to everything in that directory, and further down, you could do it with git submodules.
如果所有 css/ux 文件都在一个特定的子文件夹中,并且您希望他能够访问该目录中的所有内容,并且更进一步,您可以使用 git 子模块来完成。
The contractor would have push/pull rights to the repo that is a submodule, but no commit rights on the main repo.
承包商对作为子模块的 repo 具有推/拉权限,但对主 repo 没有提交权限。
You could also just use the pull request feature and make sure that he only commits to the folder he wants.
您也可以只使用拉取请求功能并确保他只提交到他想要的文件夹。
回答by denishaskin
I haven't done this, but seems like maybe you have 2 options:
我还没有这样做,但似乎你有两个选择:
1) Grant the contractor pull access (but not push) to the repository. They can then fork it, do their work on their fork (probably within a branch?) and then send you pull requests and you would need to pull his/her changes in. Downside is that the contractor can't get code released to the server without your intervention (that could be an upside, depending).
1) 授予承包商对存储库的拉取访问(但不推送)。然后他们可以分叉它,在他们的分叉上做他们的工作(可能在一个分支内?)然后向你发送拉取请求,你需要拉他/她的更改。缺点是承包商无法将代码发布到服务器无需您的干预(这可能是一个好处,具体取决于)。
2) If their work is isolated to one subtree, use two repositories and make one a submodule of the other. You can then set the access control differently in the 2 repositories, but you get a unified view of the project.
2) 如果他们的工作与一个子树隔离,则使用两个存储库并使一个存储库成为另一个的子模块。然后,您可以在 2 个存储库中以不同的方式设置访问控制,但您可以获得项目的统一视图。