Skip to content

Add OAuth flow to automatically register SSH keys with GitHub #20

Closed

Description

@neuromechanist

Context

Issue #19 proposed auto-registering SSH keys with GitHub. The current implementation in the feature branch generates SSH keys and configures SSH locally, but requires users to manually add the key to their GitHub account.

Why manual step is required

To add an SSH key to a user's GitHub account programmatically, we need:

  1. OAuth authorization from the user (to get a token with admin:public_key scope)
  2. Or a Personal Access Token from the user

The backend currently only has the org admin PAT (GITHUB_ADMIN_PAT), which can manage organization resources but cannot add SSH keys to individual user accounts.

Proposed Solution

  1. Add GitHub OAuth flow to the CLI:

    • nemar auth connect-github - Opens browser for OAuth authorization
    • User grants permission for SSH key management
    • Backend stores the user's OAuth token securely
  2. Update setup-ssh to use the OAuth token:

    • If user has connected GitHub via OAuth, auto-register the SSH key
    • If not, show manual instructions (current behavior)

Benefits

  • Fully automated SSH setup after OAuth is connected
  • No manual copy-paste of SSH keys required
  • Better user experience for users who authorize the OAuth flow

Considerations

  • OAuth adds complexity (token refresh, secure storage)
  • Some users may prefer manual key management
  • Need to handle token revocation gracefully

Related

Activity

  1. added
    P3
    feature
    cli
    on Jun 18, 2026
  2. neuromechanist commented on Sep 3, 2026

    @neuromechanist
    ContributorAuthor

    Closing as obsolete. The primary auth and clone path is HTTPS through gh auth login (src/commands/dataset.ts builds https clone URLs), and setup-ssh's own help text now describes SSH as the fallback for users who cannot use the GitHub CLI. An OAuth flow for a secondary path is no longer worth building.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3clifeature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions