开发者

Is it possible to open up only certain files/folders in my private GitHub repo for read/write access to some people?

开发者 https://www.devze.com 2023-02-13 03:32 出处:网络
I\'m looking for web designers, and would like to provide them RW access to c开发者_开发百科ertain frontend files only (html, erb files etc). I do not want them to have access to the core of my applic

I'm looking for web designers, and would like to provide them RW access to c开发者_开发百科ertain frontend files only (html, erb files etc). I do not want them to have access to the core of my application on GitHub. Is there a way to do this?


Since those frontend files are directly related to your core app, the submodule solution (isolating those files in submodules) would be too cumbersome.

A possible solution, if you don't want them to see at all your files in the core section, would be to setup a second private independent repo, initialized with only your frontend files.
There would be no direct link between the two repos, but at least:

  • your developers could push modifications to that second repo
  • you could regularly extract as patches any evolutions and apply those to your local repo (before pushing them to your first private repo)
  • or you could extract as patches your own evolutions made on those same files by you, and apply them to the second repo.

If you don't mind them to see the core files, but only want to prevent any modifications in the core app, then Mark Longair's answer is your solution.


Note: Mark reminds me in the comments below that a Git repo can have multiple roots (multiple commits with no parent).

That means, instead of communicating through mails and patches, you actually can import directly the master branch of the second repo directly in your first private repo, as an independent branch (a branch with no common history with your current base code).

From there, you can cherry-pick the commits you want to apply to your own code, or you can cherry-pick your own evolution to that independent branch, before pushing it back to the second repo (the one for the developers to work on).


The simplest solution is probably to have your designers fork your repository on github. They just push their changes to their github repository and and click "Pull Request" when they want you to merge in their work. You could then have a small script that you run in your local copy that:

  1. Checks that you're on master (or whatever your main branch is)
  2. Runs git fetch web-designer-one
  3. Checks that git diff --name-only master web-designer-one/master only contains files that you allow that person to change
  4. If that's fine, runs git merge web-designer-one/master

(I was interpreting "has access to" to mean "allow them to change", but perhaps I misunderstand - if you don't want them to even be able to see the other files then VonC's answer is better.)

0

精彩评论

暂无评论...
验证码 换一张
取 消