diff options
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | git/git-mirror.md | 35 |
2 files changed, 36 insertions, 0 deletions
@@ -1,4 +1,5 @@ # Homelab wiki This wiki serves as a documentation and reminder for myself when administrating my homelab. + Applying anything you see in here, on your own setup, is at your own risk. diff --git a/git/git-mirror.md b/git/git-mirror.md new file mode 100644 index 0000000..ba26f85 --- /dev/null +++ b/git/git-mirror.md @@ -0,0 +1,35 @@ +# How to create a git mirror + +## Hook + +On the server, within the bare git repository, create a post-receive hook with the following content : + +```sh +#!/usr/bin/env bash +# Push changes to GitHub +git push --mirror github +``` + +And make it executable : + +```sh +chmod +x <repository path>/hooks/post-receive +``` + +## Remote + +Configure the remote github repo : + +``` +# Making sure ssh works with the user, +# else create an ssh key and add it on github +ssh -T git@github.com +# > Hi <user>! You've successfully authenticated, but GitHub does not provide shell access. + +# Add the remote github repo +git remote add github git@github.com:<user>/<repository name>.git +``` + +## Validate + +Now you should be able to make a simple push to the git server and see github updated as well. |