Skip to content

Instantly share code, notes, and snippets.

@devinschumacher
Last active August 23, 2024 01:51
Show Gist options
  • Save devinschumacher/539a6332baf22480341e6de4593911d2 to your computer and use it in GitHub Desktop.
Save devinschumacher/539a6332baf22480341e6de4593911d2 to your computer and use it in GitHub Desktop.
How to Setup & Connect additional Github.com Account(s) to the Github CLI
title
How to Setup & Connect Additional Github.com Account(s) to the Github CLI

How to Setup & Connect additional Github.com Account(s) to the Github CLI

Assuming you've already created your additional Github account, here are the steps:

  1. Generate a PAT (personal access token) // not going to go through these steps
  2. Generate an SSH key
  3. Connect your account to github

1. Generate a PAT (personal access token)

// not going to go through these steps

2. Generate an SSH key

In your terminal, run the following command and then follow the obvious prompts:

ssh-keygen -t ed25519 -C "<your-github-account-email>"

3. Connect your account to github

In terminal, run the following command and then follow the obvious prompts:

gh auth login

Prompts:

  • What account do you want to log into?: GitHub.com
  • What is your preferred protocol for Git operations on this host?: SSH
  • Upload your SSH public key to your GitHub account? <path-to-your.pub>
  • Title for your SSH key: GitHub CLI
  • How would you like to authenticate GitHub CLI?

You are now logged in.

To switch between your accounts, use:

gh auth switch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment