Configuring Git to use Multiple Accounts (Mac)

If you use multiple accounts with Git (for instance, a work or personal GitHub account in addition to your GA GitHub Enterprise account), you need to configure git a bit differently than the default instructions outlined on github.com. Use this page as your guide for finishing your GitHub Enterprise setup.

  1. Log into your account at https://git.generalassemb.ly
  2. Follow these instructions to create a new SSH Key (a special, very secure, key which allows your laptop access to your github account without having to remember your github password), with the following exceptions:
  3. Generating a new SSH key, Step 3

    When you're prompted to "Enter a file in which to save the key," type /Users/[username]/.ssh/id_rsa_ga, where [username] is your Mac username, and then press Enter.

    Adding your SSH key to the ssh-agent, Step 2

    When adding your key to the SSH agent, you need to add additional information the ~/.ssh/config file.

    • In your editor, open your home directory, navigate to the .ssh folder, then open the file named config (if this file doesn't exist, go to the terminal, run touch ~/.ssh/config, then open the file in your editor.)
    • Add a second entry to your file using the following as a template:
      
          # my GitHub account 
          Host personal
            HostName github.com
            User git
            AddKeysToAgent yes
            UseKeychain yes
            IdentityFile ~/.ssh/id_rsa
            IdentitiesOnly yes
          
          # GA github Enterprise
          Host GA   
            HostName git.generalassemb.ly
            User git
            AddKeysToAgent yes
            UseKeychain yes
            IdentityFile ~/.ssh/id_rsa_ga
            IdentitiesOnly yes
          
          # wildcard
          Host *
            AddKeysToAgent yes
            UseKeychain yes
        
    • Save your changes
  4. Add your new SSH Key to GitHub Enterprise following these instructions
  5. Verify your key works by running the following:
  6. ssh -T git@git.generalassemb.ly

    You should see output similar to:

    Hi <you>! You've successfully authenticated, but GitHub does not provide shell access. Connection to git.generalassemb.ly closed.