Fully immersing myself into iOS development for the next few months.

git-header-image

Setting up Git HTTP Backend for local collaboration

You want to share a topic branch with a colleague but do not want to push that branch upstream to Github/BitBucket/GitLab, etc. How do you do this? You could create a patch and email it. Or you could use Apache and allow your colleague to pull from your repo directly. This does take a bit more time to setup, but would be the most convenient for everyone involved. The basic idea is that you “host” the git repos on your local machine, and push your commits to it as you are developing. You then make your git repos available via Apache on your internal network to allow team members to pull from your local repo.

First create a place to store your repos. Let’s also create a test repo to work with to make sure everything is working.

Next let’s setup Apache (I am using OS X El Capitan with Apache 2.4).

Edit /private/etc/apache2/httpd.conf.

Ensure the following modules are being loaded.

Uncomment the following line:

Edit /private/etc/apache2/extra/httpd-vhosts.conf.

I removed the existing virtualhosts since I actually do all of my development with Vagrant and Linux. So I really have no need to have anything more than a single virtualhost on my Mac.

Edit the the bolded parts to suit your local setup.

Restart apache.

Your git repos will now be available at http://locahost/git/<REPONAME.git>.

You should now be able to clone your empty repo.

Let’s test it out.

You should be able to make changes and push to your remote.

There it is!

Now you can have a colleague pull changes directly from you. Simply provide them with your public address, for example http://192.168.1.120/git/testproject.git, and they should now be able to clone your repo, add your remote, pull changes, etc.

If you want other people to be able to push to your repo you will have to explicitly allow this. In your testproject.git repo, set the http.receivepack value to true:

Executed a huge Drupal operation and nothing broke. Nothing. I am more scared now than I was before I started this task.