NAME

GitHub::Config::SSH::UserData - Read user data from comments in ssh config file

VERSION

Version 0.06

SYNOPSIS

use GitHub::Config::SSH::UserData qw(get_user_data_from_ssh_cfg);

my $udata = get_user_data_from_ssh_cfg("johndoe");

or

my $udata = get_user_data_from_ssh_cfg("johndoe", $my_ssh_config_file);

DESCRIPTION

This module exports a single function (get_user_data_from_ssh_cfg()) that is useful when using multiple GitHub accounts with SSH keys. First, you should read this gist https://gist.github.com/oanhnn/80a89405ab9023894df7 and follow the instructions.

To use get_user_data_from_ssh_cfg(), you must add information to your ssh config file (default ~/.ssh/config) by adding comments like this:

Host github-ALL-ITEMS
#  User: John Doe <main@addr.xy> <foo@bar> additional data
   HostName github.com
   IdentityFile ~/.ssh/abc
   IdentitiesOnly yes

Host github-minimal
#  User: <main@addr.xy>
   HostName github.com
   IdentityFile ~/.ssh/mini
   IdentitiesOnly yes

Host github-std
#  User: Jonny Controlletti <main-jc@addr.xy>
   HostName github.com
   IdentityFile ~/.ssh/std
   IdentitiesOnly yes

Host github-std-data
#  User: Alexander Platz <AlexPl@addr.xy> more data
   HostName github.com
   IdentityFile ~/.ssh/aaaaa
   IdentitiesOnly yes

The function looks for Host names beginning with github-. It assumes that the part after the hyphen is your username on github. E.g., in the example above the github usernames are ALL-ITEMS, minimal, std and std-data.

The next line must be a comment line beginning with User: followed by an optional name (full name, may contain spaces) followed by one or two email addresses in angle brackets, optionally followed by another string. See the examples above.

The following function can be exported on demand:

AUTHOR

Klaus Rindfrey, <klausrin at cpan.org.eu>

BUGS

Please report any bugs or feature requests to bug-github-config-ssh-userdata at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=GitHub-Config-SSH-UserData. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SEE ALSO

https://gist.github.com/oanhnn/80a89405ab9023894df7

App::ghmulti, Dist::PolicyFiles, Git::RemoteURL::Parse

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc GitHub::Config::SSH::UserData

You can also look for information at:

LICENSE AND COPYRIGHT

This software is copyright (c) 2025 by Klaus Rindfrey.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.