Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><a href="https://stackoverflow.com/a/8781450">Esko</a> suggested great solution suitable for open-source projects. However it requires that every member of a collaborators team has a paid account on GitHub, which is not always true.</p> <p><a href="https://stackoverflow.com/a/18865454/1914227">VonC</a> pointed out that there's another solution which involves only one paid GitHub account. And I'm going to provide some tutorial how to implement VonC's solution.</p> <p>Let's suppose that we have two private repositories: <code>test-test</code> and <code>test-production</code>. The first repo is for development and every member of a team has access to it. The second repo is for automatic deployment of code and therefore strong access restrictions are applied to it.</p> <p>Setup for developers is pretty simple and staightforward: <code>git clone https://github.com/&lt;username&gt;/test-test</code>, do their work and push it back.</p> <p>Setup for collaborators is a bit more complicated: </p> <ol> <li><p>Pull branches from the development repo <code>git clone https://github.com/&lt;username&gt;/test-test</code></p></li> <li><p>Add remote repository <code>git remote add production-repo https://github.com/&lt;username&gt;/test-production.git</code></p></li> <li><p>Fetch data from new repo <code>git fetch production-repo</code></p></li> <li><p>Create new local branch for production code and switch to it <code>git checkout -b local-production</code></p></li> <li><p>Tell git to link local and remote branches <code>git branch -u production-repo/production</code></p></li> <li><p>Download contents of the remote production branch to the local one <code>git pull</code></p></li> <li><p>Sort out possible conflicts and that's it!</p></li> </ol> <p>Now everything that is pushed from the <code>local-production</code> branch will get into the <code>test-production</code> repo and the other branches will be pushed to the <code>test-test</code> repo.</p> <p><em>Ok, that's cool, but what about more granular ([person's name]-development) access?</em> - You may ask. The answer is: you can create repos similar to <code>test-test</code> for every developer and use the same pattern for setting them up. The downside of this approach is that collaborators will have to clone each of <code>test-test-[person's name]-development</code> repos.</p> <p><em>VonC also suggested to fork the <code>production</code> repo and to make pull requests to it - why not to do like that?</em> Firstly, because you can't fork a private repo without having paid GitHub account. Secondly, to allow someone to fork a <strong>private</strong> repo, you give him full access to it, so he can push to it directly. And a developer can make a mistake, push to the <code>production</code> repo launching GitHub service hooks and screwing things up. And if you use several outsource developers, this will likely happen.</p> <p>Also I'd like to warn you about a <strike>bug</strike>feature in the official GitHub app for Windows. The branches with an upstream different from the origin will get into origin. So use the command line for pushing.</p> <p>All these things sound little bit overcomplicated. But it is always like that if you don't want to pay for simplicity.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload