https://github.com/shaleh/setup-git-repo
Scripts to configure a git repo with user name and password
https://github.com/shaleh/setup-git-repo
automation git hooks
Last synced: 2 months ago
JSON representation
Scripts to configure a git repo with user name and password
- Host: GitHub
- URL: https://github.com/shaleh/setup-git-repo
- Owner: shaleh
- License: bsd-3-clause
- Created: 2016-08-17T19:08:47.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-08-17T19:12:51.000Z (almost 10 years ago)
- Last Synced: 2025-06-11T05:04:38.952Z (about 1 year ago)
- Topics: automation, git, hooks
- Language: Shell
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Simple script to setup a git repo. It looks for `~/.config/git/work-settings`
or `~/.config/git/personal-settings` based on the value of `git remote`'s `origin`.
`git-validate-my-config` should be placed in your path before the real git-*
commands. Install it like so:
install -m 755 git-validate-my-config ~/bin
cd ~/bin
ln -s git-validate-my-config git-review
I set up my `~/.gitconfig` like so:
[init]
templatedir = ~/.git-templates
And in there I have a `hooks/pre-commit` that is simply:
#!/bin/sh
git validate-my-config || setup-git
Now whenever I clone a repo the hook is in place and whenever I commit the hook ensures
the configuration is correct and current. `git init` run on a repo that was cloned previously
will safely re-apply the templates.