Push git changes to a shared network drive

GitNetworkingPushSharedDrive

Git Problem Overview


How can a team of four people use Git (specifically Github for Windows) to push local changes to a shared network drive?

Right now (without Git) we have to copy the files from the network drive to our local machine, edit the files, and then re-upload them to the shared network drive. This is a painstaking process that can lead to lots of errors, but it seems like something Git could help us with.

Can we simply install Git on the shared drive and go from there?

Git Solutions


Solution 1 - Git

Not sure if you found something that works for you or not, but I have a writeup on how to do that very thing on a windows network drive:

http://tony.halcyonlane.com/blog/2011/09/22/Using-git-at-work-on-a-Windows-network-drive/

From a cmd prompt change to your mapped drive. > $ cd g:

Then cd into your soon to be git repository. > $ cd scripts

Then create an empty git repository. If you do not use the --bare option, you will have issues so don't leave that out. > $ git init --bare

Now if you don't have a local git repository yet, then you can clone your new repository wherever you like by navigating back to your local drive. > $ c: > > $ cd work/scripts > > $ git clone file://g:\scripts

When you clone, you automatically get a remote called "origin" and you can push to the server for safe keeping any time you make changes locally. > $ git push origin master

If you already have a git repository and you just want to push out to the shared drive then you can do this from within your local git dir. > $ git remote add origin file://g:\scripts > > $ git push origin master

Solution 2 - Git

Our team currently does exactly this. Every developer has the following:

  1. Git installed on their local machine
  2. Access to their own personal shared drive (L:)
  3. Access to a shared group drive (V:)

We have the "remote" repository (set up using init -bare) on the V: drive, and everyone has a clone on their personal L: drive. All changes are made to the L: drive and pushed up to the V: drive, which are then pulled down later by the other developers to their respective personal repositories on their L: drives. This works without any problems, and mitigates the need for a Git server.

Solution 3 - Git

You can add another remote pointing to your network drive (git remote)

Then you can push pull similar to what you do with github

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser1549303View Question on Stackoverflow
Solution 1 - GitTony EichelbergerView Answer on Stackoverflow
Solution 2 - GiteykanalView Answer on Stackoverflow
Solution 3 - GitbluesmanView Answer on Stackoverflow