Git - Viking without Github

Is the forking function specific to github? or is there a pure git process for creating β€œcopied” child repositories that can pull updates from the parent? If so, how?

EDIT: I have to be confused by what git clone does. As far as I understand, git clone is what I do on my machine to get a local copy of the repository to make commit and push changes. We are currently posting our repositions with gitosis . So, if I wanted to accompany the fork, would I clone the repository on the gitosis server itself (at the beginning)? Create a new git address?

+7
source share
4 answers

You probably don't want to do this. The branches in git are very nice and light, and there really is no reason why you should not just create a branch in the repository that you have right now. The only reason I can come up with this with the gitosis repository is to make access control interesting if you have a continuous deployment or something that pulls out of one gitosis repository and you want to give the code access to the same code but don’t want them to be able to write those that have been deployed. For all other purposes, you just need to create a branch with git branch and do all your work in the branch. Alternatively, you might want to clone the github repository and then work on it in your central gitosis architecture.

Given this preliminary warning, the easiest way to create a fork in the way you describe is to create a separate repository on the gitosis server. Therefore, configure another repository with a different name - for example, if your source repository is gitosis@server :repo1.git , you must set another one in gitosis@server :repo1-fork.git . Add all the users you want to access.

Then you clone the repository: git clone gitosis@server :repo1.git , which puts the full copy of the repo in ./repo1 . To copy it from the local version to the forked repository, you can do git push gitosis@server :repo-fork.git --mirror .

+7
source

Viking on Github is the equivalent of a simple git clone , although in the case of fork, it is more like git clone --mirror .

+6
source

Anytime you git clone repository, you actually created the plug. The only thing the GitHub plug functionality does is to clone the GitHub repo, with a web page, graphs and statistics and all this good stuff.

In addition, when you clone a repository, Git automatically makes the default source repository an upstream repo (remote origin call). So, from git pull without arguments should be pulled directly from the original.

+4
source
 # clone wanted repo git clone https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git # cd into created folder cd ORIGINAL_REPOSITORY # add your remote repository as origin git remote add origin https://github.com/my_user/my_repository.git # add original repository as upstream git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git # when want to pull from upstream just git pull upstream master # when want to create upstream pull-request just # https://git-scm.com/docs/git-request-pull # commit-hash - from where to start pull request git request-pull commit-hash git@github.com :my_user/my_repository.git 
+3
source

All Articles