Mapping users from GitHub.com to GitHub Enterprise with LDAP

Many companies use LDAP for managing user access and directory services within their organization. Often a client may choose GitHub Enterprise and wish to use their existing LDAP protocols to manage users on their GitHub Enterprise instance.

When migrating users from GitHub.com to GitHub Enterprise and using LDAP for authentication, we can easily map users to their respective user names.

Scenario

GitHub.com Username

LDAP Username

NitesWatchGuy

jsnow

Khaleesi

dtargaryen

2short4u

tlannister

sclegane

sclegane

DireWolf

[N/A]

Prerequisites

This playbook assumes that you have performed the beginning of a migration and have reached the "Map records and resolve conflicts" step.

Generate a mapping manifest

In order to map the records, simply create a CSV file with mapping instructions to give to ghe-migrator. If users do not already exist on the GitHub Enterprise instance, they will be created and immediately suspended.

Note that the user "DireWolf" does not have an LDAP username. If you do not wish to migrate a user, you can map the user to "ghost", the reserved account for deleted users.

ldap_users.csv

model_name,source_url,target_url,recommended_action
user,https://github.com/NitesWatchGuy,https://ghe.example.com/jsnow,map
user,https://github.com/Khaleesi,https://ghe.example.com/dtargaryen,map
user,https://github.com/2short4u,https://ghe.example.com/tlannister,map
user,https://github.com/sclegane,https://ghe.example.com/sclegane,map
user,https://github.com/DireWolf,https://ghe.example.com/ghost,map

Use the manifest with the map command

Once the mappings are in place, simply pass them into the map command.

ghe-migrator map -i /home/admin/ldap_users.csv -g $MIGRATION_GUID

Last updated