This took a little effort to get all the pieces right, especially for me on the Mac, so I thought I would share the information.

I've recently taken the leap to start using Git, mostly so that I could share ProxyFoo on GitHub, but I've been happy enough with it to start using it on an internal project also. I wanted a simple way to have a central GIT repository for my internal projects. I didn't find the any of the "server" projects that appealing or overkill and since I'm a lone developer I'm choosing to go with the simple file sharing approach for now. I'm using SourceTree as a client on Mac and Windows.

Why

My development machine is backed up daily and I work alone so I don't absolutely need to have a central repository. However, I've always felt there should be a central repository that is the "master". I run an in-office server for backup, file storage, and builds so this fits in well. Once the project matures a little bit I'll probably set up a continuous integration server like TeamCity. No requirement for building a product should only live in your development workspace. You should be able to pull down from your source control, maybe install a few prequisites (which I store centrally) and build.

I also have some projects on Mac OS X on my laptop that I would like to backup as well and this machine is not backed up regularly. (On the Windows partition I do not have anything on my laptop that is not mirrored from my desktop machine.

What I did

Note that this is for when you have an existing local repo first. Replace Server with your server name, Git with your share name, and Repo with your repo name.

1. Setup the master repo

  • I created a file share called Git with full access permissions and then adjusted the file permissions for my account to have access to the folder.
  • I used git init --bare //Server/Git/Repo from the command line to create the bare repo. (A bare repo has no workspace which is precisely what I want for master repo.)

2a. Connect a Windows repo

  • Using SourceTree, add a new remote. You can do this from the main menu Repository->Add Remote... or from the Remotes header in the repo view and right click New Remote... Select the Add button on the Remotes tab and you should see the following dialog and enter the Remote Name as "origin" (or check Default remote) and enter the server path as //Server/Git/Repo.

2b. Connect a Mac repo

  • Connect to the Windows file share using the Finder. From the menu Go->Connect to Server...
  • Set up an automatic connection to the network drive on login.
  • Using SourceTree, add a new remote. You can do this from the main menu Repository->Add Remote... or from the Remotes header in the repo view and right click New Remote... Select the Add button on the Remotes tab and you should see the following dialog and enter the Remote Name as "origin" and enter the server path (this is important) as /Volumes/Git/Repo.

3. Push