Download the binary
The easiest way to install CaptainHook is by downloading the binary for your platform manually from the CaptainHook release page.
Install using Homebrew
Installing CaptainHook via Homebrew is also supported. First you have to tap the Captains Formula then you can install the Captain.
$ brew tap captainhook-go/captainhook $ brew install captainhook
Install using `go install`
If you have go installed you can use it to install the Cap'n using go install
$ go install github.com/captainhook-go/captainhook/cmd/captainhook@latest
The next step is to create a configuration file, to define the actions you want to execute for each git hook. You can either use a sample configuration from the documentation or create one by running the following command.
$ captainhook init
After creating the configuration file, there is only one step left to finish the installation. You must activate the hooks in your local git repository. To do so, just run the following command.
$ captainhook install
Executing this will create the hook script located in your .git/hooks directory, for each hook you choose to install while running the command. So now every time git triggers a hook, CaptainHook gets executed.
AYE! Ye have successfully installed CaptainHook to handle yer git hooks. Want to know how to set sail?
Have a closer look at thee configuration file to setup yer git hooks.
Don't ye forget it is still possible to commit without invoking thee hooks. Make sure ye run appropriate backend-sanity checks on yer code, so yer hearties don't break anything AYE!!!