Skip to content

Instantly share code, notes, and snippets.

@hell0again
Created August 19, 2015 03:22
Show Gist options
  • Save hell0again/7ccc3929d89b85cde49b to your computer and use it in GitHub Desktop.
Save hell0again/7ccc3929d89b85cde49b to your computer and use it in GitHub Desktop.
deploy key運用向けにGIT_SSHで指定するラッパースクリプト
#!/bin/sh
# Description:
# GIT_SSH wrapper for github "deploy key" solution
#
# Usage:
# 1. create ssh key in .ssh/deploy_key/${YOUR_REPO}/id_rsa{,.pub}
# 2. register the created ssh key as deploy key
# 3. GIT_SSH=~/.ssh/git_ssh git pull origin master
set -eu
[ ${SET_X:-false} = true ] && set -x
SCRIPT_DIR=$(cd $(dirname $0) && pwd)
KEYS=$(find ${SCRIPT_DIR}/deploy_key/ -type f ! -name "*.pub")
#echo ssh $(for key in ${KEYS}; do printf ' -i %s' ${key}; done) $@
ssh $(for key in ${KEYS}; do printf ' -i %s' ${key}; done) $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment