Skip to content

Instantly share code, notes, and snippets.

@nicholsonjf
Created March 8, 2014 03:20
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicholsonjf/9424846 to your computer and use it in GitHub Desktop.
Save nicholsonjf/9424846 to your computer and use it in GitHub Desktop.
Add a remote mirror on a network drive from a local Git repository (Windows)
This stackoverflow question was a huge help: http://stackoverflow.com/questions/1887364/git-clone-to-external-drive-for-backup
If you use Git on you development machine, it's good to keep a remote backup in case your dev machine fails.
Step 1: Create the empty bare repo on your network drive
$ mkdir O:/myrepo_backup
$ cd O:/myrepo_backup
$ git init --bare
Step 2: Add a remote to the repo you want to mirror
$ cd C:/myrepo
$ git remote add --mirror=push backup O:/myrepo_backup
Step 3: Push local repo to remote repo on network drive
$ cd C:/myrepo
$ git push remote
Now you should have a remote mirror of you local repo!
Every time you want to push changes to your mirror, just repeat Step 3.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment