A
A
Alexey Kopendakov2018-02-27 08:06:49
git
Alexey Kopendakov, 2018-02-27 08:06:49

How to work with two git servers?

Tell me how to organize the following more correctly:
There is a git server in the local area that is not accessible from the Internet (the Internet itself from the server is accessible without problems). While the work is going on locally, everything is simple and clear.
Now it was required to give access to a repository from the Internet. What's the easiest way to organize it?
The first thought that was - to create an account on gitlab and set up synchronization in some way. the whole question is how, and what are the pitfalls of such a solution.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stanislav, 2018-02-27
@stanislav-belichenko

First you need to understand the scheme of working with Git as such, as it is used everywhere. When working on a project with the involvement of more than 1 person, it is generally accepted to make a really common repository remote for both developers, we will call it the head repository, with which each of them would exchange changes.
In this case, you can use both your own server and ready-made sites like Gitlab, Github, Bitucket and others as hosting for the head repository. It is important to understand that if this is your server, then the repositories in it should not be both the working folders of your combat projects, and the working folders of test projects, too, in a good way, the head repository usually lives in a completely separate place, from where everyone contacts it other and local changes do not threaten him, as it can be with the working folder of the working or test server of the project, when someone wants to quickly make some kind of bug fix for profit.
Based on all this, I would advise you to choose one or another site to host your head (usually it gets the name origin) repository and then set up access to it from all the developers' working machines, plus you can do the same on the working / test server of your project , and expand after there your project. Data exchange will take place through fetch / pull / push commands, a lot has been written about them in detail.
I would advise you to choose Bitbucket, as it has the free ability to create private repositories and create small development teams there. After creating the repository, it will give you the necessary instructions on how to connect your local project, even if it has already been created earlier (and it has its own local repository for a long time), even if it is created right now:
At the same time, I personally don’t see much point in leaving your server in LAN and making it some kind of intermediate between your local network and the Internet, this will be a duplication of functionality - its only function could be to replace the Internet server in case of failure at the provider, but it’s unlikely you often have them so often that you cannot live without sharing commits between developers on your local network (if there are more than 1) for a while, saving commits only to your local copies of the repositories. But even if there is such a problem, it is rather worth making your local server accessible from the Internet (I think there is no point in explaining ways), in one way or another - this will give you all the benefits right away.

S
Stepan Krapivin, 2018-02-27
@xevin

on gitlab, github and bitbucket it is possible to call hooks when uploading edits (pushing) to the repository.
As I see it:
On the local - the main repository.
1) it has (git remote) a remote mirror repository (which is on gitlab/github/bitbucket)
2) a git hook is configured, which, when pushing to the locale, pushes and takes it to / from the mirror
On gitlab/github/bitbucket is uploaded mirror repository.
With the help of webhook or pipeline triggers, sending a request for the locale to pull the uploaded edits from the mirror to a separate branch is configured.
Those. when they push to the local, the local turnip, using git-hook, is synchronized with the mirror.
And when they push to the mirror, synchronization is requested from the locale using the webhook.
More or less like this.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question