This is a simple bash script to aid users with the git and GitHub setup process. It will do a few things:
- Set values in your global git config:
- user.name
- user.email (used by GitHub to match commits to their author)
- github.user & github.token (used by third-party apps that interact with GitHub and Gist)
- Help you create a new ssh key if one is not found
- Upload your public ssh key to your GitHub account
- Ensure ssh-agent loads for msysgit users
This script has been tested on OSX Snow Leopard and Msysgit. You must have git installed before you run this script.
Downloading and running the script
$ git clone git://github.com/help/setup.git $ setup/setup.sh GitHub username not found, please enter: tekkub GitHub token not found in global git config Please enter GitHub password for tekkub (this will not be saved): Fetching API token Saving GitHub token to global git config Enter git committer name (return to use 'tekkub'): Enter git committer email (return to use '[email protected]'): No id_rsa key found, generate one? (y/n) y **************************************************************************** * GitHub highly recommends you use a strong passphrase on your key * * Visit http://help.github.com/working-with-key-passphrases/ for more info * **************************************************************************** Generating public/private rsa key pair. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /Users/tekkub/.ssh/id_rsa. Your public key has been saved in /Users/tekkub/.ssh/id_rsa.pub. The key fingerprint is: 67:f1:d6:da:55:22:e0:7f:22:f5:47:f1:16:a6:59:fc [email protected] Upload id_rsa key to your github account? (y/n) y
Msysgit (windows) users will be presented with an extra option, since ssh-agent doesn’t load by default in msysgit:
You appear to be running Msysgit, would you like to use the ssh-agent loader? This script will load ssh-agent to save your passphrase so that you don't need to re-enter the passphrase every time you use your ssh key. For more info visit http://help.github.com/working-with-key-passphrases/ Install script to your .bashrc file? (y/n) y Script installed, you will need to re-open git bash to load your key. [Tekkub@KAKU: ~ master]$