Last active
July 6, 2018 20:39
-
-
Save xkr47/8348709 to your computer and use it in GitHub Desktop.
How to set up a remote (non-bare) Git repository with read-only checkout of some branch to automatically update on push. This assumes you have already created a regular repository in the remote location already; typically just "git init".
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat > .git/hooks/post-receive <<EOF | |
#!/bin/bash | |
set -e | |
cd .. | |
unset GIT_DIR | |
git reset --hard HEAD -- | |
# put any additional cleanup/reload commands here | |
EOF | |
chmod ug+rx .git/hooks/post-receive | |
git config receive.denyCurrentBranch ignore |
If you have multiple users accessing this repository, you probably want to apply https://stackoverflow.com/questions/5306768/file-permission-issues-with-sharing-a-git-remote-repository
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This should be run in the root of the remote repository