how to add someone to private repository github code example

Example 1: how to give access in the git hub

Ask for the username of the person you're inviting as a collaborator.
Under your repository name, click Settings.
In the left sidebar, click Collaborators.
Under "Collaborators", start typing the collaborator's username.
Select the collaborator's username from the drop-down menu.
Click Add collaborator.

Example 2: 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.