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
AI-generated summary
In a support discussion titled “Restrict users who are member to see my private github repos,” hhf.technology asks how to share private GitHub repositories with logged-in members of their closed forum. Arkshine explains that GitHub requires users to be added as collaborators for direct access, or alternatively, a fine-grained personal access token can be generated for read-only git clone access via URL (e.g., git clone https://<username>:<token>@github.com/<username>/<repo>). Arkshine outlines steps to generate such a token and cautions that manually adding collaborators isn’t scalable for large communities, suggesting alternatives like repository snapshots or custom plugins via GitHub API — though these may not be ideal long-term. hhf.technology confirms they’re currently using the token method but seek a more robust solution, clarifying that “member” means simply logged-in users within their closed forum. The discussion highlights the tension between GitHub’s access model and forum-based permission needs, with no out-of-the-box solution offered beyond token-based workarounds or custom development.
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.
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:
-
Go to Settings
→ Developer Settings
→ Personal access tokens
→ Fine-grained tokens
→ Click on Generate new token button. -
Select the repositories you want to share
-
Select the access level in Repository permissions.
For read-only access, you would want to set Contents to Read-only. -
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?
Your solution i am currently using to achieve this.
git - Can I share my private GitHub repository by link? - Stack Overflow
Just logged in.
But i needed something robust. but i have no idea how to approach this.
My forum is a closed forum.