Skip to content

Instantly share code, notes, and snippets.

@jasonnicholson
Created February 22, 2023 03:02
Show Gist options
  • Save jasonnicholson/2214de0abbccd80f56dfaa3b97ab001e to your computer and use it in GitHub Desktop.
Save jasonnicholson/2214de0abbccd80f56dfaa3b97ab001e to your computer and use it in GitHub Desktop.
Setting up repo git hooks, configuration, and default configuration for git lfs
# Create a folder for git hooks
mkdir .githooks
# Configure hooks in a git configuration file stored in the repo
# Note, you will need to use -f flag to modify this file with git config
# later.
git config -f .gitconfig core.hooksPath .githooks
# Add .gitconfig as an include in the LOCAL configuration file
git config --local include.path ../.gitconfig
# Install some hooks into .githooks. git-lfs uses hooks and I need
# them installed to work with my repos.
git lfs install
# Setup a post clone script which adds the local configuration to
# the local repo.
echo 'git config --local include.path ../.gitconfig' > post-clone-script.sh
# Add the hooks, configuration, and post clone script to your repo
git add .gitconfig .githooks/* post-clone-script.sh
# Commit to the repo
git commit -m "chore: adding hooks, configuration, and post clone script"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment