4

I've hosted Smart HTTP GIT on my VM, what I'm unable to do is to create a fork. Is there any command or something through which I can fork my self-hosted GIT.

Why do I need to fork the repository, so that 10 developers can fork the base repository and work on their own instance, once their code is good to go they can do a pull request. Once they have made the pull request the GIT admin can check and review the code and if everything seems to be fine they that pull request will be accepted or else it will be denied.

Note: I'm not asking how to fork, I'm asking how to fork on a self-hosted GIT repository which is nothing but my remote GIT repository is on one of my VM/Server instead of Github/Bitbucket etc.

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
Rishi Kulshreshtha
  • 1,748
  • 1
  • 24
  • 35
  • 2
    A "fork" is just a clone of the repo. See [Are git forks actually git clones?](http://stackoverflow.com/q/6286571/1445366). See meagar's answer specifically. – Aaron Brager Jan 12 '16 at 05:14
  • OK, but what I need is to use the fork feature in my self-hosted GIT repository, is that possible? If yes, then how? – Rishi Kulshreshtha Jan 12 '16 at 05:18
  • You are basically asking us how to use Git. Can you narrow down your question? – Tim Biegeleisen Jan 12 '16 at 05:23
  • @TimBiegeleisen, I've updated the question, hope that can provide some more clarity on my issue. – Rishi Kulshreshtha Jan 12 '16 at 05:27
  • For this purpose, we normally use branching. Typically, a release candidate is built from a branch called "master" or a different name that conveys the version number. Developers or teams of developers create their own branches, and push/pull from those, until they are ready to merge into the master branch. At that point, a proper review takes place. While working on a side branch, developers need to merge the master branch to the side branch from time to time, to keep it up to date. – Adi Levin Jan 12 '16 at 05:36
  • Forks and pull requests are not a feature of Git. If you don't have the layer which implements these features, you need to manage the flow manually. It's not very complex or spectacular, so it's still hard to see how your question is not asking about how to handle Git clones. – tripleee Jan 12 '16 at 05:44

1 Answers1

3

There is no "fork" in Git, only a clone on the server side (but without any "link" between the two repos)

Once you have duplicated a repo on the server side ("fork"), any pull request can be emulated by the native command "git request-pull".

Generate a request asking your upstream project to pull changes into their tree.
The request, printed to the standard output, begins with the branch description, summarizes the changes and indicates from where they can be pulled.

See "How to send pull request on GIT".

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 1
    So basically, I've to clone the bare GIT repository on the server side manually and then treat that repository as "forked" which is not a feature of GIT but doing so we can achieve that? – Rishi Kulshreshtha Jan 12 '16 at 05:54
  • 1
    @RishiKulshreshtha yes: any clone of a bare repo on the server side can be considered as a "fork". But the point remains: there is no nice integration between the two repo, nor is it a nice interface for "pull request" with native git. – VonC Jan 12 '16 at 05:56
  • 1
    Thanks for the clarity @VonC :-) – Rishi Kulshreshtha Jan 12 '16 at 06:05
  • "only a clone on the server side" — a `clone --bare` or `clone --mirror` or something else? – theonlygusti Sep 25 '19 at 08:21
  • @theonlygusti mirror, but the storage/access details remains specific to GitHub operational environment. (as described in https://github.blog/2016-09-22-introducing-glb/) – VonC Sep 25 '19 at 10:43
  • @VonC if I want to "host my own fork", is it alright to simply `git clone --mirror ` – theonlygusti Sep 25 '19 at 10:50
  • @theonlygusti Yes, and then you can push it back to a server of your own (https://stackoverflow.com/a/57899888/6309) or store a backup (https://stackoverflow.com/a/54473697/6309) – VonC Sep 25 '19 at 11:55