I forked a public repo and made the new repo private.
I added a new remote branch on my private repo with some fixes committed.
Now, I want to create a pull request from the branch in my private repo towards the public repo I forked from.
I select the branch in my private repo and click "Pull request".
I click on "Change commits".
I can't change the organisation/repo owner. I only see my organisation, but not the one of the public repo. I could only create a pull request against master branch of my private repo, but that's not what I want.
Is it not possible to fix something of a public repo in a private one and create a pull request afterwards?
Changing a repository's visibilityOn GitHub.com, navigate to the main page of the repository. Under your repository name, click Settings. Under "Danger Zone", to the right of to "Change repository visibility", click Change visibility. Select a visibility.
No. You can fork it and it still remains private. Private collaborators may fork any private repository you've added them to without their own paid plan. Their forks do not count against your private repository quota.
Pull requests opened on private repositories remain private. Therefore, if you aim to prevent students from copying others' solutions, then you'd better consider making the assignments private. To do so, you could ask GitHub for an academic discount on your organization.
Create Pull Request Now if you open a public repository you get this: After clicking on Compare & pull request you get: GitHub will alert you that you are able to merge the two branches because there is no competing code. You should add in a title, a comment, and then press the “Create pull request” button.
One solution would be to fork the original public repo into your own public repo on GitHub.
Then duplicate your forked public repo into a private one.
You then clone both on your local workstation, and:
@VonC's answer is conceptually correct and still the one supported by GitHub. After nine years, @Sebi finally gets the answer he wanted -- I eliminated the "indirection" he commented on that occurs in the second bullet of VonC's answer.
For my use case, I need to make both public and private changes to a public repo. Public commits can be pushed periodically as soon as they are ready. Private changes must remain in my private repo until I complete my PhD research. At that time, I'll need all private changes to flow from my public fork to the original public repo via pull requests.
The bulk of the work is getting things set up correctly. I provided detailed steps in this SO answer. The following steps are done exclusively in the eclipse GUI (v2020-12; EGit 5.11), but can easily be translated to command line operations. The repositories I used are these:
eclipse/org.aspectj
is the original public repo; the upstream
remote for fetchingcb4/org.aspectj
is my fork; the origin
remote for pushingcb4/remPrivAJ
is my remote private repo; the private
remote for pushing and pullingI:\local
is the local repo on my workstationFor github authentication, I used ssh with an ed25519 ssh key (how-to in this SO question) so my connection URIs look like this: ssh://[email protected]/<user>/<repo>
.
Notation: ->
is a mouse click or selection; right->
and double->
are right-click and double-click, respectively.
I separated public from private changes by putting each in separate branches: pub
for public changes; priv
for private changes. I'm fairly new to git, so there may be a better way to do this.
Branches
then open Local
(-> v
beside each)right-> master -> Create Branch -> Select -> private/master -> Ok
enter priv for Branch name: -> Configure upstream for push and pull -> When pulling: Merge -> Finish
right-> master -> Create Branch
enter pub for Branch name: -> Finish
private/master
, my public fork orign/master
, and the original public repo upstream/master
all match
Git Staging
tab in the Git Perspective-> Commit and Push -> Preview -> Push -> Close
right-> priv -> Push Branch -> Remote: dropdown v -> origin: URI
(mine is origin:ssh://[email protected]/cb4/org.aspectj) double-> master
in the Branch: text box and type priv
then double-> priv [branch] -> Preview -> Push -> Close
Compare & pull request
and Voila! (click image to zoom).
Additional Features and Functions
right-> pub -> Push Branch -> Preview -> Push -> Close
right-> upstream -> Fetch
right-> origin -> Push
right-> private -> Push
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With