how to share a private github repository

How to Share a Private GitHub Repository

By Thomas White
AD

Collaboration is key to success in software development. GitHub, with its vast ecosystem of tools and features, facilitates this collaboration elegantly. However, especially in professional environments, shared code isn't always about public repositories. Often, private repositories are necessary to protect sensitive information or to coordinate across small, select teams. So, how can we share a private GitHub repository? Let's explore.

Before we dive into sharing, let's clarify that making a repository private on GitHub doesn't prevent others from accessing your code. You must explicitly share it with specific people. This article will guide you through that process.

Inviting Users to the Repository

Sharing a private GitHub repository involves inviting specific users with GitHub accounts. Here's how:

AD
How to create repository on GitHub - The Tech Edvocate
How to create repository on GitHub - The Tech Edvocate
How to Create Your First Repository on Github
How to Create Your First Repository on Github
How To Create A GitHub Repository In This Easy Step-by-step Guide For Beginners.
How To Create A GitHub Repository In This Easy Step-by-step Guide For Beginners.

1. Navigate to your repository page. Click on Settings in the top-right corner.

Inviting via Email

Inviting users by email is straightforward and can be a good option if you're not sure about collaborators' GitHub handles.

How to create GitHub repository - The Tech Edvocate
How to create GitHub repository - The Tech Edvocate
10 GitHub Repositories for the Self-Taught Developer
10 GitHub Repositories for the Self-Taught Developer

2. In the left-side menu, click on Manage access.

3. Within this section, scroll down to the Invite a user text field. Here, you can type the email address of the collaborator you'd like to invite.

AD

Inviting via GitHub Handle

If you know the collaborator's GitHub handle, inviting them is even simpler:

2. In the left-side menu, click on Manage access.

3. In the same Invite a user text field, instead of an email, type the user's GitHub handle preceded by the '@' symbol, e.g., '@exampleUser'.

AD

Setting Collaborator Permissions

Inviting users grants them the Read permission by default. This means they can see your repository but not make changes. If you want them to contribute, you'll need to adjust their permissions:

1. After inviting the user, you'll see they've been added to the manage access list. Click on their user icon.

Granting Write Permission

To allow collaborators to contribute to your repository, change their access to Write.

AD

2. Select Write from the permissions dropdown menu.

Granting Administer Permission

If you trust a collaborator with extensive control over the repository, you can grant them Admin rights. This provides the same privileges as the repository owner.

2. Select Admin from the permissions dropdown menu.

Once you've selected the desired permissions, a confirmation dialog will appear. Confirm to finalize the changes. Now, your invited user will receive an invitation to join your repository with the specified permissions.

Finally, while sharing and collaborating, remember to nurture open communication and code review to maximize the benefits of sharing your private repositories.

AD