Skip to content

Instantly share code, notes, and snippets.

@nderjung
Created May 17, 2019 12:01
Show Gist options
  • Save nderjung/8eefefb8ff167222dc7850c58689064a to your computer and use it in GitHub Desktop.
Save nderjung/8eefefb8ff167222dc7850c58689064a to your computer and use it in GitHub Desktop.
Git mirror via post-receive hook
#!/bin/sh
GIT_REMOTE_REPO=git@github.com:nderjung/my-cool-mirror.git
SSH_KEY=~/.ssh/id_my_cool_mirror
GIT_DIR=${GIT_DIR:-$(dirname $0)}
GIT_SSH_COMMAND="ssh -i $SSH_KEY -F /dev/null -oStrictHostKeyChecking=no" git push --mirror $GIT_REMOTE_REPO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment