2

I just want to know, if possible, how can I make a specific branch public in a private GitHub repository?

1 Answer 1

3

It's not possible to make a specific branch public in a private repository. GitHub doesn't support this, and I'm not aware of any hosting providers which do.

In general, making only certain branches public doesn't match very well with the way Git works, which is that references are fetched before the data. Git will only prompt for authentication credentials over HTTPS if it gets a 401 response. However, if there were any references that were public, then the server would have to return those instead of a 401 response, so there would be no way to see all of the private references, since Git wouldn't know to send authentication credentials.

Sign up to request clarification or add additional context in comments.

3 Comments

Ok. Thanks. I don't know if it would make a difference, but the branch would only need read permission (no need to allow commit, etc.).
The opposite also is not possible? In a public repository, make specific branches private (the master branch, by example)?
Everything I said above is true about every case in which some references (including branches) are public and some are private.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.