Help us shape the future of Go! Take the 2026 Go Developer Survey

ssh

package
v1.57.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SetupCmd = &cobra.Command{
	Use:   "setup",
	Short: "Setup SSH keys for GitHub access",
	Long: `Setup SSH keys for GitHub access. This command will:
  - Check for existing SSH keys
  - Attempt to retrieve SSH keys from Bitwarden vault
  - Generate new SSH keys if none found
  - Configure SSH config for GitHub`,
	RunE: func(cmd *cobra.Command, _args []string) error {
		if err := SetupSSH(cmdutil.IsVerbose(cmd)); err != nil {
			return fmt.Errorf("ssh setup failed: %w", err)
		}
		return nil
	},
}

SetupCmd runs the SSH setup flow.

View Source
var SshCmd = &cobra.Command{
	Use:   "ssh",
	Short: "Manage SSH keys for GitHub access",
	Long:  `Check for existing SSH keys, retrieve from Bitwarden, generate new ed25519 keys, and configure SSH for GitHub.`,
	RunE: func(cmd *cobra.Command, _args []string) error {
		return cmd.Help()
	},
}

SshCmd manages SSH keys for GitHub and general access.

Functions

func DetectSSHBackupCandidates

func DetectSSHBackupCandidates() []string

DetectSSHBackupCandidates scans common local locations for SSH backup folders containing key files.

func EnsureSSHConfig

func EnsureSSHConfig(sshKeyPath string) error

EnsureSSHConfig ensures ~/.ssh/config contains the Host github.com configuration block.

func FindGitHubSSHKey

func FindGitHubSSHKey(sshDir string) string

FindGitHubSSHKey locates the primary GitHub SSH private key within sshDir.

func GenerateSSHKey

func GenerateSSHKey(sshKeyPath string, verbose bool) (bool, error)

GenerateSSHKey generates a new ed25519 SSH key pair and attempts to register it in GitHub.

func MigrateSSHFromBackup

func MigrateSSHFromBackup(sourceDir, destDir string, verbose bool) error

MigrateSSHFromBackup copies all SSH keys, public keys, and config from sourceDir into destDir, enforcing secure permissions.

func SetupSSH

func SetupSSH(verbose bool) error

SetupSSH handles SSH key setup for GitHub and general access with multiple sources.

func SetupSSHForGitHub

func SetupSSHForGitHub(verbose bool) error

SetupSSHForGitHub exposes the SSH setup flow for other commands that need GitHub access.

func SetupSSHFromBitwarden

func SetupSSHFromBitwarden(sshKeyPath string, verbose bool) error

SetupSSHFromBitwarden retrieves SSH keys from Bitwarden vault and configures them locally.

func ValidateGitHubSSHAuth

func ValidateGitHubSSHAuth(sshKeyPath string, verbose bool) error

ValidateGitHubSSHAuth verifies GitHub SSH connectivity using the specified key.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL