• Stars
    star
    309
  • Rank 135,306 (Top 3 %)
  • Language
    Go
  • License
    MIT License
  • Created about 9 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Git plugin that prevents sensitive data from being committed.

Git Hound

Travis Code Climate GoDoc

Hound is a Git plugin that helps prevent sensitive data from being committed into a repository by sniffing potential commits against PCRE regular expressions.

How does it work?

Upon commit, it runs the output of git diff -U0 --staged through the Hound, which matches every added or modified line against your provided list of regular expressions from a local .githound.yml file.

Installation

To install Hound, please use go get. If you don't have Go installed, get it here. If you would like to grab a precompiled binary, head over to the releases page. The precompiled Hound binaries have no external dependencies.

go get github.com/ezekg/git-hound

If you're on macOS, you can also install using Homebrew:

brew install git-hound

Compiling

To compile for your operating system, simply run the following from the root of the project directory:

go install

To compile for all platforms using gox, run the following:

gox

Usage

git-hound [<opts>] commit [...]
git-hound [<opts>] sniff [<commit>]

Commit

Sniff changes before committing.

# Sniff changes since last commit and pass to git-commit when clean
git hound commit …

Sniff

You can optionally pass a commit hash or manually pipe a diff for the Hound to sniff.

# Sniff changes since last commit
git hound sniff HEAD

# Sniff entire codebase
git hound sniff

# Sniff entire repo history
git log -p | git hound sniff

Option flags

Flag Type Default Usage
-no-color bool false Disable color output
-config=file string .githound.yml Hound config file
-bin=file string git Executable binary to use for git command

Example .githound.yml

# Output warning on match but continue
warn:
  - '(?i)user(name)?\W*[:=,]\W*.+$'
  - '\/Users\/\w+\/'
# Fail immediately upon match
fail:
  - '[''"](?!.*[\s])(?=.*[A-Za-z])(?=.*[0-9])(?=.*[!@#$&*])?.{16,}[''"]'
  - '(?i)db_(user(name)?|pass(word)?|name)\W*[:=,]\W*.+$'
  - '(?i)pass(word)?\W*[:=,]\W*.+$'
# Skip on matched filename
skip:
  - '\.example$'
  - '\.sample$'

More Repositories

1

flint

Flint is a powerful Sass grid framework designed for rapid responsive development.
CSS
244
star
2

xo

Command line utility that composes regular expression matches.
Go
184
star
3

example-rails-webhook-system

An example of building a webhook system with Rails and Sidekiq
Ruby
30
star
4

example-rails-api-key-authentication

Example of implementing API key authentication in Ruby on Rails without Devise
Ruby
28
star
5

sass-prof

A code profiler for Sass libraries
Ruby
25
star
6

sympm

sympm allows you to run npm install from inside of a Vagrant virtual machine without hitting symlink issues
JavaScript
16
star
7

sitepoint-programmatically-insert-wp-posts

PHP
14
star
8

graphite

Graphite imports a folder of fonts and automagically outputs their font-face directives for you.
Ruby
13
star
9

sassy-export

Sassy Export is a lightweight Compass extension that allows you to export an encoded Sass map into an external JSON file.
Ruby
10
star
10

chrome-new-tab-vocab

Google Chrome extension that shows you a new word definition every time you open a new tab.
HTML
9
star
11

chrome-github-auto-tab-indent

Google Chrome extension that automatically adjusts tab indentation on GitHub (and Bitbucket!)
JavaScript
6
star
12

example-rails-totp-2fa

An example of implementing TOTP 2FA in a Ruby on Rails app using the ROTP gem.
Ruby
5
star
13

download-in-browser

JavaScript
5
star
14

guard-mthaml

Guard::MtHaml automatically compiles your MtHaml template files to PHP, Twig or static HTML.
PHP
3
star
15

channy

channy is a synchronous channel-like observer that allows easy orchestration of events
CoffeeScript
2
star
16

sitepoint-theme-juice

1
star
17

theme-juice-functions

Theme Juice helper-functions library.
PHP
1
star
18

theme-juice-vm

Deprecated in favor of our new virtual machine:
Shell
1
star