Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
## This script takes a list of HTTPS GitHub repository urls in a file called "repos.txt", creates a directory for each unique org, generates an RSA SSH key for each and stores in the directory,
## adds the keypair to a credhub import file, and uploads the public key to the GitHub repository as a read-only deploy key using API token from file token.txt.
## --tmarshall 20190703
#set -x
set -e
repos=`cat repos.txt` || { echo "A repos.txt file with list of repos is required."; exit 1; }