GitHub – Allow Collaborators to Add Themselves

github

I'd like to send out a URL to an external team such that anyone who clicks on it can join my private repository as a collaborator using a read-only role.

I don't want individually to add every person who needs access, nor do I want to give someone else the authority to do this.

Is there any way to do this using GitHub?

Best Answer

Only someone with admin rights to the repository can add collaborators, so there's no way for a potential collaborator to automatically add themselves via a URL.

However, you can use the GitHub API to programmatically add collaborators. You can make use of the API in several ways. Here are two possible approaches:

  • Write a script to add any and all users as collaborators, either as a one-time execution or to use on-demand when you have new users to add.
  • If you have access to a web server, Microsoft form, or some other method for having the user submit a request or respond to a request, write a server-side script to add any user who responds to your email/form/etc. as a collaborator.

The second approach would be more precise, as it wouldn't add users who don't want to be collaborators, but it would also require more setup.