I have a Java application in a private repository on GitHub and I would like to share it with someone who doesn't have an account. I didn't find any option on the site for this.
Is there a way to do this? Collaborators can be only GitHub users.
You can use read-only access token to share a private repository.
git clone https://<username>:<token>@github.com/<username>/<repo>.git
To generate a new token:
Under your user profile go to Settings > Developer Settings > Personal access tokens > Fine-grained tokens > Generate new token.
Select the repositories you want to share under Repository access > Only select repositories.
Set the access level of the token to read-only in Permissions > Repository permissions > Contents > Access: read-only.
Finally, click on Generate token.