Skip to content

Instantly share code, notes, and snippets.

@liginv
Last active September 10, 2016 08:28
Show Gist options
  • Save liginv/0aa9248753b272035eb2b778558d05a7 to your computer and use it in GitHub Desktop.
Save liginv/0aa9248753b272035eb2b778558d05a7 to your computer and use it in GitHub Desktop.
Add a remote mirror on a network drive from a local Git repository (*nix)
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(backup folder).
so you first have to clone it: in the original repo do:
$ git clone --bare /path/of/the/exsisting/repo
This will copy your repository data to the network folder.
Step 2: In the version controlled folder, add a new remote.
$ git remote add --mirror=push backup /path/of/the/backup/folder/
Step 3: Push local repo to remote repo on network drive from the working folder
$ git push backup
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