1

We are stuck with this weird situation: the clash of company policies that we have to resolve with a little bit of engineering.

Imagine a company C, and two employees, Alice and Bob. Alice is an internal employee of C, Bob is a third-party outsourcer/contractor. Alice and Bob work on the same project, which is stored on the Git server inside the company. However, now the company policy prohibits Bob to access the internal server. It does not prohibit Alice and Bob to exchange emails about the project, but the collaboration through Git now has to be modified somehow.

Here's one solution that we came up with:

  1. Bob sets up a local Git repository on his machine outside the company and commits his changes there.
  2. Alice uses Bob's repository as a remote, and pulls changes from there to her machine inside the company.
  3. Alice syncs these changes with the changes done by the other people in the company (stored on the internal Git server).
  4. Alice sends a email with some kind of a diff of the two repositories to Bob.
  5. Bob applies this "diff" to his local repository.

Our goal is the following: after step 5, Bob's repository should end up in exactly the same state as if he just did a simple git pull from the internal server inside the company. Now the question is, how can this be accomplished? What kind of a "diff" can we prepare for two repositories? Essentially, is there a way to realize the information exchanged during a pull?

Of course, the simplest thing would be to send a (compacted) copy of the entire repository by email, but this would be insanely large and utterly unproductive. Is there a better way to accomplish this?

Thank you!

Skiminok
  • 2,801
  • 1
  • 24
  • 29
  • 1
    This effort looks pointless to me because, as you said `Bob's repository should end up in exactly the same state as if he just did a simple git pull from the internal server`. You can make a repo as read-only for a user and integrate his work via pull requests. – Roman Newaza Jul 30 '14 at 04:05
  • @RomanNewaza Bob cannot integrate Alice's work via pull requests, because Bob's computer cannot connect to any computers inside the company (including the shared Git server or Alice's machine). Alice cannot integrate Bob's work via pull requests, because for that the internal server has to be made read-only for Bob, but the policy prohibits Bob to even _read_ from the internal server. – Skiminok Jul 30 '14 at 04:20
  • No, Bob has read-only access to company repo so he is able to pull and there's integrator user who is dealing with pull requests coming from third party, Bob – Roman Newaza Jul 30 '14 at 04:22
  • @RomanNewaza Unfortunately, as I said, Bob is not allowed to have even a read-only access to the company repo. If we could make that happen, our life would be much easier. – Skiminok Jul 30 '14 at 04:24
  • Use GitHub Organization then – Roman Newaza Jul 30 '14 at 04:26
  • @RomanNewaza Do you really think that a company with such a ridiculous policy would allow their code to be stored on the server of a third-party company, such as GitHub? Bob is allowed to store the code on his own machine alone, and that's it. He can setup a Git repository there, and give Alice any required rights, but he cannot put this code anywhere else, nor can he access the internal servers. Yes, I know this policy is stupid. We, the developers, cannot do anything about it. We can only deal with it by setting up some engineering solution. That's why I'm asking advice on StackOverflow. – Skiminok Jul 30 '14 at 04:31
  • 2
    I'd run away from such paranoid company. End of story. – Roman Newaza Jul 30 '14 at 04:33
  • Why can't Alice pull Bob's work into a separate branch, merge whatever needs to be merged into that branch and push the branch to Bob? Does it have to be by email? – Eli Algranti Jul 30 '14 at 05:01

2 Answers2

1

the simplest thing would be to send a (compacted) copy of the entire repository by email,

You actually can do that, in an incremental way: send a git bundle (see "How can I email someone a git repository?").

I detail ways to do an incremental bundle in "Transferring changes made to multiple branches using git-bundle".
The easiest is by date:

cd myRepo
git bundle create mybundle-inc --since=10.days --all

The idea is to generate one file, from which you can pull from (as if that file was a git repo).

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
0

Apart from sending a Git bundle as answered by @VonC, if Alice can access Bob's PC, then he can set up a bare repository into which Alice pushes her changes. This bare repository will essentially be a mirror of the company's internal repository.

Apart from that I don't see what this ridiculous policy should achieve. With or without it, Bob will have the same data (if Alice pushes/sends bundles)

knittl
  • 246,190
  • 53
  • 318
  • 364