Usually you just need to change the domain on the GitHub side. We do mention this in the howto on changing your domain name – all social logins need to be changed to reflect the new domain.
We always associate logins based on email, so as long as the user logs in with the same email (either manually via click-the-emailed-guid-link, or automatically via a provider that sends a validated email) they will enter the Discourse account that matches that validated email.