Skip to content

Instantly share code, notes, and snippets.

@tylerwalts
Last active December 16, 2020 11:43
Show Gist options
  • Select an option

  • Save tylerwalts/7127099 to your computer and use it in GitHub Desktop.

Select an option

Save tylerwalts/7127099 to your computer and use it in GitHub Desktop.

Revisions

  1. tylerwalts renamed this gist Oct 23, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. tylerwalts created this gist Oct 23, 2013.
    50 changes: 50 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,50 @@
    #!/bin/sh

    # Place the SSH key for the git service account used to access private repositories

    home_path="$(cd && pwd)"
    ssh_path="$home_path/.ssh"
    mkdir -p $ssh_path
    provider="bitbucket.org"
    #provider="github.com"

    echo "Creating temporary ssh key"
    echo "-----BEGIN RSA PRIVATE KEY-----
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000
    -----END RSA PRIVATE KEY-----" > $ssh_path/git-account-key

    echo "Setting perms on ssh key"
    chmod 600 $ssh_path/git-account-key


    echo "Adding key to user ssh config"
    touch ~/.ssh/config
    echo "Host $provider
    IdentityFile $ssh_path/git-account-key" >> ~/.ssh/config

    echo "Adding known host for $provider"
    ssh-keyscan -t rsa $provider >> ~/.ssh/known_hosts