# Restrict users who are member to see my private github repos

**URL:** https://meta.discourse.org/t/restrict-users-who-are-member-to-see-my-private-github-repos/358283
**Category:** Support
**Created:** [March 21, 2025, 6:28am UTC](https://meta.discourse.org/t/restrict-users-who-are-member-to-see-my-private-github-repos/358283 "2025-03-21T06:28:38Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![hhf.technology](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hhf.technology/32/465129_2.png) [@hhf.technology](https://meta.discourse.org/u/hhf.technology)
#### Post date: [March 21, 2025, 6:28am UTC](https://meta.discourse.org/t/restrict-users-who-are-member-to-see-my-private-github-repos/358283/1 "2025-03-21T06:28:38Z")

</div>

how to share private Github repos with users who are logged in and members of my forum.  
Is it even possible. or is there a way around how to achieve this. ?  
Any guidance appreciated

---

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [March 22, 2025, 2:08am UTC](https://meta.discourse.org/t/restrict-users-who-are-member-to-see-my-private-github-repos/358283/3 "2025-03-22T02:08:06Z")

</div>

To share a private GitHub repository through a browser, a user must have a GitHub account and be added as a collaborator. See [Inviting collaborators to a personal repository - GitHub Docs](https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-access-to-your-personal-repositories/inviting-collaborators-to-a-personal-repository).

If sharing a GitHub link for cloning is acceptable, you can create a fine-grained (e.g., read-only) personal access token. This token will allow others to access it only through git (clone).  
For example: `git clone https://<username>:<token>@github.com/<username>/<repo>`

> **How to generate a new token:**
>
> 1. Go to Settings  
> → Developer Settings  
> → Personal access tokens  
> → Fine-grained tokens  
> → Click on Generate new token button.
> 
> 2. Select the repositories you want to share
> 
> 3. Select the access level in Repository permissions.  
> For read-only access, you would want to set Contents to Read-only.
> 
> 4. Click on Generate token, you’re done!

It depends on what kind of access you’re looking for, if temporary access, whether you are a small/big community.

For example, you will not manually add every user if you are a large community. Creating a plugin to add/remove a collaborator through the GitHub API automatically is possible, but that doesn’t seem like a good long-term solution. You might need to create a snapshot of the repository and share it another way.

By member, do you mean behind a subscription or just logged in?  
Do you think you could elaborate more about your context?

---

<div class="post-metadata">

### Author: ![hhf.technology](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hhf.technology/32/465129_2.png) [@hhf.technology](https://meta.discourse.org/u/hhf.technology)
#### Post date: [March 22, 2025, 12:41pm UTC](https://meta.discourse.org/t/restrict-users-who-are-member-to-see-my-private-github-repos/358283/4 "2025-03-22T12:41:31Z")

</div>

Your solution i am currently using to achieve this.

[git - Can I share my private GitHub repository by link? - Stack Overflow](https://stackoverflow.com/questions/31264165/can-i-share-my-private-github-repository-by-link)

> [@Arkshine](#):
>
> By member, do you mean behind a subscription or just logged in?

Just logged in.  
But i needed something robust. but i have no idea how to approach this.  
My forum is a closed forum.
