{"id":13625218,"url":"https://github.com/azu/git-hooks","last_synced_at":"2025-04-16T06:32:01.018Z","repository":{"id":43366382,"uuid":"245631895","full_name":"azu/git-hooks","owner":"azu","description":"@azu's global git hooks","archived":false,"fork":false,"pushed_at":"2024-04-29T13:19:18.000Z","size":313,"stargazers_count":18,"open_issues_count":2,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-05-02T00:20:31.341Z","etag":null,"topics":["git","global","hooks","secretlint"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/azu.png","metadata":{"funding":{"github":"azu"},"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-07T12:49:10.000Z","updated_at":"2024-05-08T23:38:54.390Z","dependencies_parsed_at":"2023-11-27T01:34:52.533Z","dependency_job_id":"088e8f35-bd46-4715-88e2-4accb541160e","html_url":"https://github.com/azu/git-hooks","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azu%2Fgit-hooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azu%2Fgit-hooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azu%2Fgit-hooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azu%2Fgit-hooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/azu","download_url":"https://codeload.github.com/azu/git-hooks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223700288,"owners_count":17188292,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["git","global","hooks","secretlint"],"created_at":"2024-08-01T21:01:52.631Z","updated_at":"2025-04-16T06:32:01.011Z","avatar_url":"https://github.com/azu.png","language":"Shell","funding_links":["https://github.com/sponsors/azu"],"categories":["Shell"],"sub_categories":[],"readme":"# @azu/git-hooks [![Actions Status](https://github.com/azu/git-hooks/workflows/test/badge.svg)](https://github.com/azu/git-hooks/actions?query=workflow%3A\"test\")\n\n[@azu](https://github.com/azu)'s global git hooks.\n\n## Features\n\n- Global Git Hooks collection\n    - Using [`core.hooksPath`](https://git-scm.com/docs/githooks) on Git 2.9+\n- If project has set up local git hook, call local hooks too\n    - Order: local hooks -\u003e global hooks \n- Define ignoring project by `IGNORE_GLOBAL_HOOKS` file\n\n## Hooks\n\n- `pre-commit`\n    - [secretlint](https://github.com/secretlint/secretlint) prevent to commit credentials\n\n## Installation\n\n**Requirement:**\n\n- Node.js 22+\n- Git 2.9+\n- 1Password CLI\n\nCheck if you already have any global git hooks:\n\n    git config --global core.hooksPath\n\nIf output is not empty, run following steps:\n\n```shell script\n# clone this repository\ngit clone https://github.com/azu/git-hooks.git git-hooks\ncd git-hooks\n# Install Dependencies\nyarn install\n# setup git config\ngit config --global core.hooksPath $(pwd)/hooks\n```\n\n## Load env using 1Password CLI\n\n    op inject --in-file .env.local.template --out-file .env\n\n## Zsh Integration\n\nSome project have defined `core.hooksPath` in git config.\n\n- Example: [Git Hooks without extra dependencies like Husky in Node.js project - DEV Community 👩‍💻👨‍💻](https://dev.to/azu/git-hooks-without-extra-dependencies-like-husky-in-node-js-project-jjp)\n\nGit prefer to use local `core.hooksPath` than global `core.hooksPath`.\n\nSo, I've overridden the local `core.hooksPath` with global hooks paths.\n\n```\n# Override \u003cproject\u003e/.githook → \u003cglobal\u003e/git-hooks/hooks/\nfunction preexec_git_global_hooks() {\n  inside_git_repo=\"$(git rev-parse --is-inside-work-tree 2\u003e/dev/null)\"\n  if [ \"$inside_git_repo\" ]; then\n      githooksDir=$(git rev-parse --show-toplevel)\"/.githooks\"\n      if [ -d \"${githooksDir}\" ]; then\n        git config --local core.hooksPath \"/path/to/git-hooks/hooks\"\n      fi;\n  fi\n}\nautoload -Uz add-zsh-hook\nadd-zsh-hook preexec preexec_git_global_hooks\n```\n\n## Options\n\nYou have set up, then bootstrap script create `IGNORE_GLOBAL_HOOKS` file.\nIt is collection of absolute path to ignore global hooks.\n\n`IGNORE_GLOBAL_HOOKS`:\n```\n/path/to/my-project-a\n/path/to/my-project-b\n```\n\nIf the project path is included in `IGNORE_GLOBAL_HOOKS`, global git hook does not run. \n\n## FAQ\n\n### How to ignore `pre-commit` hook\n\nUse [`--no-verify`](https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---no-verify) options.\n\n```\ngit commit --no-verify\n```\n\n## Contributing\n\nPull requests and stars are always welcome.\n\nFor bugs and feature requests, [please create an issue](https://github.com/azu/git-hooks/issues).\n\n1. Fork it!\n2. Create your feature branch: `git checkout -b my-new-feature`\n3. Commit your changes: `git commit -am 'Add some feature'`\n4. Push to the branch: `git push origin my-new-feature`\n5. Submit a pull request :D\n\n## Author\n\n- [github/azu](https://github.com/azu)\n- [twitter/azu_re](https://twitter.com/azu_re)\n\n## License\n\nMIT © azu\n\n## Acknowledgement\n\n- [globalなgit-hooksを設定して、すべてのリポジトリで共有のhooksを使う - Qiita](https://qiita.com/ik-fib/items/55edad2e5f5f06b3ddd1)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazu%2Fgit-hooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazu%2Fgit-hooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazu%2Fgit-hooks/lists"}