github how to add collaborator code example

Example: how to invite someone to private github repo

Ask for the username of the person you're inviting as a collaborator. If they don't have a username yet, they can sign up for GitHub For more information, see "Signing up for a new GitHub account".
On GitHub, navigate to the main page of the repository.
Under your repository name, click  Settings.
In the left sidebar, click Manage access.
Click Invite a collaborator.
In the search field, start typing the name of person you want to invite, then click a name in the list of matches.
Click Add NAME to REPOSITORY.
The user will receive an email inviting them to the repository. Once they accept your invitation, they will have collaborator access to your repository.