问题
Bob, Ben and Mike are working on an awesome project.
Bob has created a local branch named foo. Bob will share branch foo with Ben, so Ben can pull and push to it. Bob don't want show this branch to Mike. Bob don't want push this branch to origin.
What is the simplest setup for such scenario ?
回答1:
The easiest way to manage authorization access remains adding an extra layer like Gitolite on your own repo, in order to manage branch access rights.
回答2:
If these repositories are on the developers local machines, you can:
Give Ben ssh access on Bob's machine and make Bob's repository readable by Ben (it already might be by default). Then Ben runs:
git remote add bob bobsmachine.example.com:/path/to/bobs/repo/ursafile
git fetch bob
Ben will now have another remote named bob like "origin" that he probably already has. Ben can do things like: git pull bob branchname
回答3:
Bob has to push this branch to Ben's local repo.
回答4:
Maybe a tool like Bananajour could be useful.
回答5:
The easiest way I've found is to create a bare repository on my computer, push whatever branches I want to it, then share that folder and assign permissions using the normal folder sharing built into the operating system. No extra software to install and learn. It doesn't scale very well, but it's great for little one-time situations.
来源:https://stackoverflow.com/questions/7660106/git-local-branch-accessible-for-coworker