Monthly Archives: May 2016

Signing Git Commits without Entering Password Using `gpg-agent` and `pinentry-mac` on OS X

Install required packages via Homebrew:

$ brew install gpg gpg-agent pinentry-mac

Edit and add the following lines in ~/.gnupg/gpg-agent.conf:

pinentry-program /usr/local/bin/pinentry-mac

Edit and enable use-agent in ~/.gnupg/gpg.conf:

use-agent

Then add the following line to your shell profile:

eval $(gpg-agent --daemon --sh)

Run `sudo` with Ansible `become` Option on Google Compute Engine

Playbook config:

- name: basic setup
  hosts: default
  user: user
  become: true
  become_user: root
  become_method: sudo
  roles:
    - tasks

If you got the following errors:

GATHERING FACTS *************************************************************** 
failed: [server1] => {"failed": true, "parsed": false}
OpenSSH_6.9p1, LibreSSL 2.1.8
debug1: Reading configuration data /Users/user/.ssh/config
debug1: /Users/user/.ssh/config line 139: Applying options for server1
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: auto-mux: Trying existing master
debug1: mux_client_request_session: master session id: 2
sudo: sorry, you must have a tty to run sudo

Then visudo and disable requiretty:

Defaults    !requiretty