26

I have been added to an organization that has some private repositories and I need to send them a pull request with some changes but I don't know if I can.

I haven't a paid account on GitHub, so how can I fork that private repo to modify and send pull requests?

James Gentes
  • 7,528
  • 7
  • 44
  • 64
Christian Giupponi
  • 7,408
  • 11
  • 68
  • 113

3 Answers3

35

As mentioned in "If I fork someone else's private Github repo into my account, is it going to appear in my account as a public repo?", you can fork a private repo (for which you were added as a private user). The resulting repo will still be private, and you will be able to make pull-requests.

Erik Humphrey
  • 345
  • 5
  • 18
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • When you say "for wich you were added as a private user", is it the same as added as a collaborator. Is it the only way one can "see" the private repo so one can fork it? – slacktracer Feb 17 '13 at 21:42
  • @jaywalking101 it is the only way I am aware of, at least. – VonC Feb 17 '13 at 22:19
5

You can make a pull request from a branch in the private repository without the need to fork it.

The workflow we are starting to use is:

 1. clone the private repository
 2. make a branch
 3. work on the branch
 4. push the branch to the private repository
 5. goto GitHub and create a pull request from the branch on the private repository
 6. someone else reviews the the pull request and decides to merge it with master on GitHub
 7. delete the branch unless there was a problem and it was not merged then go back to #3
Nothus
  • 1,127
  • 8
  • 7
  • or you could use [git flow...](http://nvie.com/posts/a-successful-git-branching-model/) – Billy Moon Sep 17 '13 at 18:28
  • 1
    When you say "clone the private repository" (and then in step #5 talk about going to the public repository on GitHub to create the pull request), that is called forking. Cloning a repository on GitHub (to your own private copy on GitHub) is what's known as forking. – David Alpert Jan 08 '15 at 14:51
  • 4
    This workflow is not possible if you have access to an orgainzation's private repos (which is essentially read-only access), but you aren't added as a collaborator to one of those repos. I had to use @VonC's solution (which worked great!!) – jungledev Dec 13 '15 at 01:50
  • I'm collaboratively working with another organization (Org A). Org A have their private repository. They have added me as a collaborator. I'm part of another organization (Org B). I have my team working as part of Org B. Neither I or my Org B has paid account. Org A has paid account. I want to fork Org A's project into Org B. Then have my team work on it to fulfill certain tasks. Then I want to generate Pull Request from Org B to Org A. With branching approach, I can't have my Org B team working. How can I achieve this. – sidnc86 Oct 05 '16 at 06:07
  • 2
    @DavidAlpert Looks like `fork` is an overloaded word. In the context of GitHub, when you press that fork button, it will ask you where on GitHub you would like to clone the repo to. I was suggesting you clone it to you local machine to work on and push up to create a PR, which, as it turns out, is also know as forking. You do not have to clone it over to your GitHub account (hit that Fork button) to create a PR. – Nothus Dec 08 '16 at 07:23
  • @sidnc86 It seems that it might be possible from the link in VonC's answer: http://stackoverflow.com/questions/9629538/if-i-fork-someone-elses-private-github-repo-into-my-account-is-it-going-to-app – Nothus Dec 08 '16 at 07:43
0

I was having a problem when trying to clone a repository that i was added to contribute, it was a private repository so i did these steps.

  1. clone the private repository using ssh (important it was not working when cloning through HTTPS).
  2. Create a new branch.
  3. Do the changes to the code
  4. Add, commit the changes and push the code to the branch you created.
  5. Go-to GitHub and go to the private repository you will se a option on top to create a pull request, just click on that and follow the steps to add description to your pull request.
  6. someone else reviews the the pull request and decides to merge it with master on GitHub

Then if the branch was merged you can delete the branch if not make the necessary changes and push the changes again and create a pull request.

Aqib
  • 1