Skip to content

Instantly share code, notes, and snippets.

@mihai
mihai / .profile
Created April 11, 2016 16:24 — forked from bmhatfield/.profile
Automatic Git commit signing with GPG on OSX
# In order for gpg to find gpg-agent, gpg-agent must be running, and there must be an env
# variable pointing GPG to the gpg-agent socket. This little script, which must be sourced
# in your shell's init script (ie, .bash_profile, .zshrc, whatever), will either start
# gpg-agent or set up the GPG_AGENT_INFO variable if it's already running.
# Add the following to your shell init to set up gpg-agent automatically for every shell
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
source ~/.gnupg/.gpg-agent-info
export GPG_AGENT_INFO
else

Keybase proof

I hereby claim:

  • I am mihai on github.
  • I am mcirlanaru (https://keybase.io/mcirlanaru) on keybase.
  • I have a public key whose fingerprint is 2783 4523 C55C B6A8 BE18 F7AC F6F4 17ED 9410 A61C

To claim this, I am signing this object:

@mihai
mihai / pre-push
Last active August 29, 2015 14:17
#!/bin/sh
# Prevent pushing to `protected_branch`.
# Just place this file in your `.git/hooks` folder and make sure it is executable
protected_branch='master'
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
if [ $protected_branch = $current_branch ]
then