How to Add Collaborators to Your GitHub Repository

You may have projects where you need to add outside collaborators to your GitHub repositories. In this guide, we'll show you how to add collaborators with the GitHub UI and the GitHub API.

Patrick Londa
Dec 14, 2022
 min read
Share this post

Coding projects often require many hands on deck, and GitHub is one of the most popular software development tools for teams to track versions and edit code in one unified location. Even in the free version of GitHub, project managers can add unlimited collaborators to private or public projects.

In this post, we’ll show you how to add Collaborators to your repository using the UI, a cURL CLI command, and the GitHub CLI.

Blink Automation: Add a Collaborator to a GitHub Repository
Blink + GitHub
Try This Automation

What permissions do you need?

Before adding collaborators, remember that there are guidelines around who can grant access to certain permission levels, even to public repositories. 

To add someone, you need to be equal to or higher in permission level to the account being granted access. If a user attempts to give access to an account above their permission level, an error message will appear, saying:

"Cannot assign [member] permission of [role name]."

These guidelines exist for safety reasons. Inviting only collaborators you trust to make changes to your repository is crucial. Otherwise, someone intending to steal or hack the code might gain entry. Therefore, it's essential to grant permission only to those with the proper credentials and know-how to keep your project bug free and safe.

Adding Collaborators via the GitHub UI

These steps below include images from GitHub's documentation.

1. In GitHub, navigate to the repository page and click Settings in the right hand corner.

repository settings

2. In the sidebar, you’ll see an Access section with a Collaborators & teams option. Click through and you’ll see an Add people button to the right of Manage Access.

Add People Button

3. You can add a collaborator using either their username, full name, or email address.

Inviting collaborators

4. Once you specify who you are inviting, you can select their level of permissions.

Setting collaborator permissions

Once the invite is sent, the recipient receives a notification. At this point, the recipient can accept or decline the invite via email or the GitHub platform.

If you run into issues, it might be because of a policy for your Enterprise that restricts who can invite outside contributors.

Enterprise permissions for inviting collaborators

You can see more details on viewing that policy information here.

Adding Collaborators Using the GitHub API

You can add collaborators to a repository with the "PUT" operation using this endpoint:


You’ll need to specify information for the following parameters:

  1. Owner Username
  2. Repository Name
  3. Username of the New Collaborator
  4. Permission Level

You can run this with the GitHub CLI, JavaScript, or a cURL command. In these examples below, we’re adding someone with the permission level “triage”. 

Here is the GitHub CLI code format to use:

# GitHub CLI api
gh api \
 --method PUT \
 -H "Accept: application/vnd.github+json" \
 /repos/OWNER/REPO/collaborators/USERNAME \
 -f permission='triage'

When using JavaScript or a command, you’ll need to include your authentication token.

Here is the JS code format to use:

// Octokit.js
const octokit = new Octokit({
  auth: 'YOUR-TOKEN'

await octokit.request('PUT /repos/{owner}/{repo}/collaborators/{username}', {
  owner: 'OWNER',
  repo: 'REPO',
  username: 'USERNAME',
  permission: 'triage'

Here is the cURL command to use:

curl \
 -X PUT \
 -H "Accept: application/vnd.github+json" \
 -H "Authorization: Bearer <YOUR-TOKEN>" \ \
 -d '{"permission":"triage"}'

You will know you’ve successfully invited a collaborator to the repository if you receive a 201 status code response.

Invite Collaborators Securely with Blink

As we’ve just shown, it isn’t difficult to invite a collaborator to a repository using any of these methods, but it does require someone context-switching and manually inviting someone. What if you intend on onboarding collaborators regularly?

With Blink, you use no-code automations like this one to invite a collaborator to your repository. You can use conditional logic to assign their specific permissions, and send an email to your new collaborator with additional guidance.

Blink Automation: Add Collaborator to Repo with GitHub and Send Results via Slack
Blink Automation: Add Collaborator to Repo with GitHub and Send Results via Slack

You can also make it a self-service application, so others can submit new collaborators and kick off an approval process.

Import this automation from the Blink library into your account and customize it based on your organization’s needs. Just drag-and-drop new actions into the canvas.

Get started with Blink and automate your unique onboarding flows today.

Automate your security operations everywhere.

Blink is secure, decentralized, and cloud-native. 
Get modern cloud and security operations today.

Get a Demo